public HIVTestResultModel PostEdit(HIVTestResultModel id) { using (var testrep = new HIVTestResultRepository()) { if (id.TestId == 0) { HIVTestResult ee = new HIVTestResult { TestId = id.TestId, //PatientName = id.PatientName, Date = id.Date, // DOB = id.DOB, // Gender = id.Gender, TestigLocation = id.TestigLocation, NextAppointment = id.NextAppointment, HIVtestType = id.HIVtestType, Status = id.Status, //PatientId=id.PatientId }; testrep.Create(ee); } else { HIVTestResult test = testrep.GetById(id.TestId); test.TestId = id.TestId; //test.PatientName = id.PatientName; test.Date = id.Date; // test.DOB = id.DOB; // test.Gender = id.Gender; test.TestigLocation = id.TestigLocation; test.NextAppointment = id.NextAppointment; test.HIVtestType = id.HIVtestType; test.Status = id.Status; //test.PatientId = id.PatientId; testrep.update(test); } return(id); } }
public void Create(HIVTestResultModel test, int PatientId) { using (var testropo = new HIVTestResultRepository()) { var Pname = pp.GetAll().ToList().Find(x => x.PatientId == PatientId); HIVTestResult ee = new HIVTestResult { TestId = test.TestId, PatientName = Pname.FullName + " " + Pname.Surname, Date = test.Date, DOB = Convert.ToDateTime(Pname.DOB), Gender = Pname.Sex, TestigLocation = test.TestigLocation, NextAppointment = test.NextAppointment, HIVtestType = test.HIVtestType, Status = test.Status, PatientId = PatientId, }; testropo.Create(ee); } }