public ActionResult DeleteCardiologicalExamination([DataSourceRequest] DataSourceRequest request, int?id) { try { if (ModelState.IsValid) { using (var db = new StoreContext()) { var item = new CardiologicalExamination() { CardiologicalExaminationId = Convert.ToInt32(id), }; db.CardiologicalExaminations.Attach(item); db.CardiologicalExaminations.Remove(item); db.SaveChanges(); } } return(Json("1", JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); } }
public ActionResult Save(CardiologicalExamination cardiologicalExamination) { try { if (!ModelState.IsValid) { return(this.Json(new { statuscode = -1, message = General.msgInvalidModel }, JsonRequestBehavior.AllowGet)); } using (var db = new StoreContext()) { // եթե 2-րդ մակարդակի աղյուսակի տողը նոր գրառումա ավելացնում ենք if (cardiologicalExamination.CardiologicalExaminationId == 0) { //ավելացնել db.CardiologicalExaminations.Add(cardiologicalExamination); } else { //Վերջում խմբագրում ենք 2-րդ մակարդակի աղյուսակի գրառումը CardiologicalExamination mCardiologicalExamination = db.CardiologicalExaminations.Find(cardiologicalExamination.CardiologicalExaminationId); mCardiologicalExamination.ResidentId = cardiologicalExamination.ResidentId; mCardiologicalExamination.CardiologicalExaminationDate = cardiologicalExamination.CardiologicalExaminationDate; mCardiologicalExamination.BloodGroupId = cardiologicalExamination.BloodGroupId; mCardiologicalExamination.RhFactorId = cardiologicalExamination.RhFactorId; mCardiologicalExamination.T3 = cardiologicalExamination.T3; mCardiologicalExamination.T4 = cardiologicalExamination.T4; mCardiologicalExamination.TTH = cardiologicalExamination.TTH; mCardiologicalExamination.CRP = cardiologicalExamination.CRP; mCardiologicalExamination.RF = cardiologicalExamination.RF; mCardiologicalExamination.ASLO = cardiologicalExamination.ASLO; mCardiologicalExamination.HIVStatusId = cardiologicalExamination.HIVStatusId; mCardiologicalExamination.HBSStatusId = cardiologicalExamination.HBSStatusId; mCardiologicalExamination.HCVStatusId = cardiologicalExamination.HCVStatusId; mCardiologicalExamination.TPHAStatusId = cardiologicalExamination.TPHAStatusId; mCardiologicalExamination.BRUStatusId = cardiologicalExamination.BRUStatusId; mCardiologicalExamination.Hb = cardiologicalExamination.Hb; mCardiologicalExamination.RBC = cardiologicalExamination.RBC; mCardiologicalExamination.FI = cardiologicalExamination.FI; mCardiologicalExamination.MeanHbRBC = cardiologicalExamination.MeanHbRBC; mCardiologicalExamination.HCT = cardiologicalExamination.HCT; mCardiologicalExamination.Platelete = cardiologicalExamination.Platelete; mCardiologicalExamination.Leukocyte = cardiologicalExamination.Leukocyte; mCardiologicalExamination.Myelocyte = cardiologicalExamination.Myelocyte; mCardiologicalExamination.Metamyelocyte = cardiologicalExamination.Metamyelocyte; mCardiologicalExamination.StabLeukocyte = cardiologicalExamination.StabLeukocyte; mCardiologicalExamination.SegmentedLeukocyte = cardiologicalExamination.SegmentedLeukocyte; mCardiologicalExamination.Eosinophil = cardiologicalExamination.Eosinophil; mCardiologicalExamination.Basophil = cardiologicalExamination.Basophil; mCardiologicalExamination.Lymphocyte = cardiologicalExamination.Lymphocyte; mCardiologicalExamination.Monocyte = cardiologicalExamination.Monocyte; mCardiologicalExamination.ESR = cardiologicalExamination.ESR; mCardiologicalExamination.ProteinTotal = cardiologicalExamination.ProteinTotal; mCardiologicalExamination.albumin = cardiologicalExamination.albumin; mCardiologicalExamination.Urea = cardiologicalExamination.Urea; mCardiologicalExamination.Creatinine = cardiologicalExamination.Creatinine; mCardiologicalExamination.UricAcid = cardiologicalExamination.UricAcid; mCardiologicalExamination.Glucose = cardiologicalExamination.Glucose; mCardiologicalExamination.BilirubinTotal = cardiologicalExamination.BilirubinTotal; mCardiologicalExamination.BilirubinDirect = cardiologicalExamination.BilirubinDirect; mCardiologicalExamination.ALT = cardiologicalExamination.ALT; mCardiologicalExamination.AST = cardiologicalExamination.AST; mCardiologicalExamination.Potassium = cardiologicalExamination.Potassium; mCardiologicalExamination.Sodium = cardiologicalExamination.Sodium; mCardiologicalExamination.Calcium = cardiologicalExamination.Calcium; mCardiologicalExamination.AAmilaza = cardiologicalExamination.AAmilaza; mCardiologicalExamination.CK = cardiologicalExamination.CK; mCardiologicalExamination.CKMB = cardiologicalExamination.CKMB; mCardiologicalExamination.TroponinStatusId = cardiologicalExamination.TroponinStatusId; mCardiologicalExamination.Cholesterol = cardiologicalExamination.Cholesterol; mCardiologicalExamination.Triglyceride = cardiologicalExamination.Triglyceride; mCardiologicalExamination.HDL = cardiologicalExamination.HDL; mCardiologicalExamination.LDL = cardiologicalExamination.LDL; mCardiologicalExamination.PT = cardiologicalExamination.PT; mCardiologicalExamination.INR = cardiologicalExamination.INR; mCardiologicalExamination.PI = cardiologicalExamination.PI; mCardiologicalExamination.APTT = cardiologicalExamination.APTT; mCardiologicalExamination.Fibrinogen = cardiologicalExamination.Fibrinogen; mCardiologicalExamination.UrineProtein = cardiologicalExamination.UrineProtein; mCardiologicalExamination.UrineLeucocyte = cardiologicalExamination.UrineLeucocyte; mCardiologicalExamination.UrineErithrocyte = cardiologicalExamination.UrineErithrocyte; mCardiologicalExamination.UrineDensity = cardiologicalExamination.UrineDensity; mCardiologicalExamination.UrineCylinderStatusId = cardiologicalExamination.UrineCylinderStatusId; mCardiologicalExamination.UrineMicroorganismStatusId = cardiologicalExamination.UrineMicroorganismStatusId; db.Entry(mCardiologicalExamination).State = EntityState.Modified; } db.SaveChanges(); return(this.Json(new { statuscode = 1, message = "" }, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { return(View("Error", new HandleErrorInfo(ex, "CardiologicalExamination", "Save"))); } }