public static PatientMeasurementRecord GetLastPain(string urNumber, int categoryId) { NHRMDBContext _con = new NHRMDBContext(); var lastPain = _con.MeasurementRecord.Join(_con.DataPointRecord, m => m.MeasurementRecordId, d => d.MeasurementRecordId, (m, d) => new { m, d }) .Where(md => md.m.Urnumber == urNumber && md.m.CategoryId == categoryId && md.m.MeasurementId == 3) .Select(md => new PatientMeasurementRecord { DateTimeRecorded = md.m.DateTimeRecorded, Value = md.d.Value }).ToList().OrderBy(o => o.DateTimeRecorded).LastOrDefault(); return(lastPain); }
//Accepts a type (string), resId (int) and content (string) as parameters and returns the appropriate content. If the type // is a 'dialog' the content returned will be an object with Heading, Content and Video properties private static dynamic GetResourceContent(string type, int resId, string content) { NHRMDBContext _con = new NHRMDBContext(); if (type.Equals("dialog")) { return(_con.ResourceDialog.Where(rd => rd.ResourceId == resId) .Select(rd => new { rd.Heading, rd.Content, rd.Video }).SingleOrDefault()); } else { return(content); } }
// Accepts a typeId (string) as a parameter and returns it's resource type, as a string public static string GetResource(int typeId) { NHRMDBContext _con = new NHRMDBContext(); return(_con.ResourceType.Where(rt => rt.ResourceTypeId == typeId).Select(t => t.TypeName).SingleOrDefault()); }
public PatientController(NHRMDBContext context) { _context = context; }
public AuthController(NHRMDBContext context) { _context = context; }