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 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;
}
}
}
{
public IEnumerable
{
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;
}
}
}
Guest UserPosted Oct 15, 2019, 3:55 AM
{
using (EmployeeEntities dbcontext = new EmployeeEntities())
{
var LeaveDays = dbcontext.tblMaster.Where(e => e.EmpCode == id).Select(o => o.LeaveDue).SingleOrDefault();
return LeaveDays;
}
}