public ActionResult DeleteCardiologicalDuplexScan([DataSourceRequest] DataSourceRequest request, int?id)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (var db = new StoreContext())
                    {
                        var item = new CardiologicalDuplexScan()
                        {
                            CardiologicalDuplexScanId = Convert.ToInt32(id),
                        };
                        db.CardiologicalDuplexScans.Attach(item);
                        db.CardiologicalDuplexScans.Remove(item);

                        db.SaveChanges();
                    }
                }
                return(Json("1", JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(ex.Message, JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult Save(CardiologicalDuplexScan cardiologicalDuplexScan)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(this.Json(new { statuscode = -1, message = General.msgInvalidModel }, JsonRequestBehavior.AllowGet));
                }

                using (var db = new StoreContext())
                {
                    // եթե 2-րդ մակարդակի աղյուսակի տողը նոր գրառումա ավելացնում ենք
                    if (cardiologicalDuplexScan.CardiologicalDuplexScanId == 0)
                    {
                        //ավելացնել
                        db.CardiologicalDuplexScans.Add(cardiologicalDuplexScan);
                    }
                    else
                    {
                        //Վերջում խմբագրում ենք 2-րդ մակարդակի աղյուսակի գրառումը
                        CardiologicalDuplexScan mCardiologicalDuplexScan = db.CardiologicalDuplexScans.Find(cardiologicalDuplexScan.CardiologicalDuplexScanId);

                        //mCardiologicalDuplexScan.CardiologicalDuplexScanId = cardiologicalDuplexScan.CardiologicalDuplexScanId;
                        mCardiologicalDuplexScan.ResidentId = cardiologicalDuplexScan.ResidentId;
                        mCardiologicalDuplexScan.CardiologicalDuplexScanDate = cardiologicalDuplexScan.CardiologicalDuplexScanDate;
                        mCardiologicalDuplexScan.RCAStenosisId = cardiologicalDuplexScan.RCAStenosisId;
                        mCardiologicalDuplexScan.RCAStenosisDM = cardiologicalDuplexScan.RCAStenosisDM;
                        mCardiologicalDuplexScan.RCAStenosisPC = cardiologicalDuplexScan.RCAStenosisPC;
                        mCardiologicalDuplexScan.LSAStenosisId = cardiologicalDuplexScan.LSAStenosisId;
                        mCardiologicalDuplexScan.LSAStenosisDM = cardiologicalDuplexScan.LSAStenosisDM;
                        mCardiologicalDuplexScan.LSAStenosisPC = cardiologicalDuplexScan.LSAStenosisPC;
                        mCardiologicalDuplexScan.RCCStenosisId = cardiologicalDuplexScan.RCCStenosisId;
                        mCardiologicalDuplexScan.RCCStenosisDM = cardiologicalDuplexScan.RCCStenosisDM;
                        mCardiologicalDuplexScan.RCCStenosisPC = cardiologicalDuplexScan.RCCStenosisPC;
                        mCardiologicalDuplexScan.LCCStenosisId = cardiologicalDuplexScan.LCCStenosisId;
                        mCardiologicalDuplexScan.LCCStenosisDM = cardiologicalDuplexScan.LCCStenosisDM;
                        mCardiologicalDuplexScan.LCCStenosisPC = cardiologicalDuplexScan.LCCStenosisPC;
                        mCardiologicalDuplexScan.RCIStenosisId = cardiologicalDuplexScan.RCIStenosisId;
                        mCardiologicalDuplexScan.RCIStenosisDM = cardiologicalDuplexScan.RCIStenosisDM;
                        mCardiologicalDuplexScan.RCIStenosisPC = cardiologicalDuplexScan.RCIStenosisPC;
                        mCardiologicalDuplexScan.LCIStenosisId = cardiologicalDuplexScan.LCIStenosisId;
                        mCardiologicalDuplexScan.LCIStenosisDM = cardiologicalDuplexScan.LCIStenosisDM;
                        mCardiologicalDuplexScan.LCIStenosisPC = cardiologicalDuplexScan.LCIStenosisPC;
                        mCardiologicalDuplexScan.RCEStenosisId = cardiologicalDuplexScan.RCEStenosisId;
                        mCardiologicalDuplexScan.RCEStenosisDM = cardiologicalDuplexScan.RCEStenosisDM;
                        mCardiologicalDuplexScan.RCEStenosisPC = cardiologicalDuplexScan.RCEStenosisPC;
                        mCardiologicalDuplexScan.LCEStenosisId = cardiologicalDuplexScan.LCEStenosisId;
                        mCardiologicalDuplexScan.LCEStenosisDM = cardiologicalDuplexScan.LCEStenosisDM;
                        mCardiologicalDuplexScan.LCEStenosisPC = cardiologicalDuplexScan.LCEStenosisPC;
                        mCardiologicalDuplexScan.RVAStenosisId = cardiologicalDuplexScan.RVAStenosisId;
                        mCardiologicalDuplexScan.RVAStenosisDM = cardiologicalDuplexScan.RVAStenosisDM;
                        mCardiologicalDuplexScan.RVAStenosisPC = cardiologicalDuplexScan.RVAStenosisPC;
                        mCardiologicalDuplexScan.LVAStenosisId = cardiologicalDuplexScan.LVAStenosisId;
                        mCardiologicalDuplexScan.LVAStenosisDM = cardiologicalDuplexScan.LVAStenosisDM;
                        mCardiologicalDuplexScan.LVAStenosisPC = cardiologicalDuplexScan.LVAStenosisPC;

                        db.Entry(mCardiologicalDuplexScan).State = EntityState.Modified;
                    }
                    db.SaveChanges();
                    return(this.Json(new { statuscode = 1, message = "" }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                return(View("Error", new HandleErrorInfo(ex, "CardiologicalDuplexScan", "Save")));
            }
        }