Charles Zvarimwa

Charles Zvarimwa

  • 1.8k
  • 23
  • 314

Cannot Implicitly convert type decimal to webservice.tblmast

Oct 15 2019 3:09 AM
I am new to web services in ASP.net and I was creating a simple webservice that pulls data from SQL server to Infopath form. My sample class before importing into infopath is shown below and is giving an error "Connot implicitly convert type decimal to webservice.tblMaster"
 
 
public class WebServiceController : ApiController
    {
        public IEnumerable<tblMaster> Get()
        {
            using (EmployeeEntities dbcontext = new EmployeeEntities())
            {
                return dbcontext.tblMaster.ToList();
            }
        }
        public  tblMaster Get(string id)
        {
            using (EmployeeEntities dbcontext = new EmployeeEntities())
            {
                var LeaveDays = dbcontext.tblMaster.Where(e => e.EmpCode == id).Select(o =>    o.LeaveDue).SingleOrDefault();
                return LeaveDays;
            }
        }
    }

Answers (1)