/// <summary> /// Returns all the Assessments of a particular Patient. /// </summary> /// <param name="patid">The Patient's file-number to use to filter the results returned.</param> /// <returns></returns> public HttpResponseMessage GetAssessmentsOfPatient(int patid) { HttpResponseMessage message; try { List <Assessment> assess = new AssessmentsBL().GetAssessmentsOfPatient(patid).ToList(); UsersBL users = new UsersBL(); Roles rol = new Roles(); var result = from a in assess select new { AssessmentId = a.AssesmentId, Worker = users.GetNameById(a.Worker_fk), Date = a.Date, Time = a.time, Type = a.AssessmentType.AssesmentTypeName, Role = rol.GetRoleName(a.Worker_fk) }; /* * var result = from a in assess select new { PatientId = a.PatientId_fk, Confirmed = a.Confirmed, Worker = users.GetNameById(a.Worker_fk), Date = a.Date, DateConfirmed = a.ConfirmationDate, AssessmentId = a.AssesmentId, Description = a.Description, Time = a.time, Type = a.AssesmentType_fk, Origin = a.Origin_fk, Duration = a.duration, TypeName = a.AssessmentType.AssesmentTypeName }; */ message = Request.CreateResponse(HttpStatusCode.OK, result); } catch { message = Request.CreateResponse(HttpStatusCode.NotFound, new HttpError("Error occurred. Please try again later.")); } return(message); }