//public IPrincipal User { get; } public void create(MedicalCertificateModel med, int PatientId)//ss, int PatientId) { PatientRepository pp = new PatientRepository(); /* RegisterRepository reg = new RegisterRepository(); * string user= User.Identity.Name; * ApplicationUser getst = reg.GetAll().ToList().Find(x => x.UserName == user); * string stuffname = getst.FullName + " " + getst.Surname;*/ DateTime da = new DateTime(); string date = da.Day + "-" + da.Month + "-" + da.Year; var dat = DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year; var Pname = pp.GetAll().ToList().Find(x => x.PatientId == PatientId); using (var medrep = new MedicalCertificateRepository()) { //var Pname = pp.GetAll().ToList().Find(x => x.PatientId == PatientId); MedicalCertificate ee = new MedicalCertificate { MedcertificateId = med.MedcertificateId, Date = DateTime.Now.Date, PatintName = Pname.FullName + " " + Pname.Surname, OpinonIllness = med.OpinonIllness, Fitnessproblem = med.Fitnessproblem, StartingDate = med.StartingDate, Enddate = med.Enddate, Comment = med.Comment, //Doctorname = med.Doctorname // Address = med.Address, PatientId = PatientId }; medrep.Create(ee); } }
public void create(MedicalCertificateModel med, int PatientId)//ss, int PatientId) { PatientRepository pp = new PatientRepository(); var Pname = pp.GetAll().ToList().Find(x => x.PatientId == PatientId); using (var medrep = new MedicalCertificateRepository()) { //var Pname = pp.GetAll().ToList().Find(x => x.PatientId == PatientId); MedicalCertificate ee = new MedicalCertificate { MedcertificateId = med.MedcertificateId, Date = med.Date, PatintName = Pname.FullName + " " + Pname.Surname, OpinonIllness = med.OpinonIllness, Fitnessproblem = med.Fitnessproblem, StartingDate = med.StartingDate, Enddate = med.Enddate, Comment = med.Comment, Doctorname = med.Doctorname, Address = med.Address, PatientId = med.PatientId, datecreated = DateTime.Now.Date }; medrep.Create(ee); } }
public MedicalCertificateModel PostEdit(MedicalCertificateModel id) { using (var medrep = new MedicalCertificateRepository()) { if (id.MedcertificateId == 0) { MedicalCertificate md = new MedicalCertificate { MedcertificateId = id.MedcertificateId, Date = id.Date, PatintName = id.PatintName, OpinonIllness = id.OpinonIllness, Fitnessproblem = id.Fitnessproblem, StartingDate = id.StartingDate, Enddate = id.Enddate, Comment = id.Comment, //Doctorname = id.Doctorname, // Address = id.Address, PatientId = id.PatientId }; medrep.Create(md); } else { MedicalCertificate med = medrep.GetById(id.MedcertificateId); med.MedcertificateId = id.MedcertificateId; med.Date = id.Date; med.PatintName = id.PatintName; med.OpinonIllness = id.OpinonIllness; med.Fitnessproblem = id.Fitnessproblem; med.StartingDate = id.StartingDate; med.Enddate = id.Enddate; med.Comment = id.Comment; //med.Doctorname = id.Doctorname; // med.Address = id.Address; med.PatientId = id.PatientId; medrep.Upadte(med); } return(id); } }