public static long AddPatientToLab(App_PatientLab PatientInfo) { using (var dbContext = new HMSEntities()) { var pat = PatientInfo; var patient = new PatientLab { PatientNo = pat.PatientNo, Name = pat.Name, Age = pat.Age, Gender = pat.Gender, RegisteredBy = pat.RegisteredBy, PerformedBy = pat.PerformedBy, Requested = DateTime.Now, Reported = null, BloodGroup = pat.BloodGroup, GuardianName = pat.GuardianName, Phone = pat.Phone, Address = pat.Address, MaritalStatus = pat.MaritalStatus, }; dbContext.PatientLabs.Add(patient); dbContext.SaveChanges(); return(patient.Id); } }
public static App_PatientLab MapPatientLab(this PatientLab source) { return(new App_PatientLab { Id = source.Id, PatientNo = source.PatientNo ?? "", Address = source.Address ?? "", Age = source.Age, BloodGroup = source.BloodGroup, Gender = source.Gender, GuardianName = source.GuardianName, Name = source.Name, PerformedBy = source.PerformedBy ?? "", Phone = source.Phone, RegisteredBy = source.RegisteredBy, ReportedOn = source.Reported.ToString(), RequestedOn = source.Requested.ToString(), MaritalStatus = source.MaritalStatus, Amount = source.Amount, DiscountBy = source.DiscountBy, Discount = source.Discount }); }