mohammed Irshad

mohammed Irshad

  • 1.5k
  • 262
  • 4.1k

Web Api Controller issue

Dec 25 2018 3:50 AM
hello,
 
Error 1 Cannot implicitly convert type 'System.Collections.Generic.List
 
Model:
public class SickLeaveData
{
public string Pat_MR { get; set; }
public Boolean IsCitizen { get; set; }
public string MedicalRecordID { get; set; }
public string PatientID { get; set; }
}
API Controller:
public class SickLeaveController : ApiController
{
public HttpResponseMessage Get()
{
List sickleavegetdata = new List();
using (MedicalHL7Entities1 dc = new MedicalHL7Entities1())
{
sickleavegetdata = dc.B_HIS_Demog_Pat_Mstr.OrderBy(a => a.Pat_MR).ToList();
HttpResponseMessage response;
response = Request.CreateResponse(HttpStatusCode.OK, sickleavegetdata);
return response;
}
}
}
 
Error:sickleavegetdata = dc.B_HIS_Demog_Pat_Mstr.OrderBy(a => a.Pat_MR).ToList();

Answers (8)