Пример #1
0
        public ActionResult Edit(ViewModelEditKT_THIETHAIKHAITHAC model)
        {
            if (ModelState.IsValid)
            {
                var selectedSucovetau   = model.SUCOVETAU.Where(x => x.IsChecked).Select(x => x.ID).ToList();
                var selectedSucovenguoi = model.SUCOVENGUOI.Where(x => x.IsChecked).Select(x => x.ID).ToList();
                KT_THIETHAIKHAITHACManager.Edit(model.ID, model.SO_DK_TAU,
                                                model.SO_THUYENVIEN,
                                                model.KHUVUC_GAPNAN,
                                                model.TG_GAPNAN,
                                                selectedSucovetau,
                                                selectedSucovenguoi,
                                                model.COQUAN_XULY,
                                                model.THIETHAI_UOCTINH,
                                                model.VIDO,
                                                model.KINHDO,
                                                model.TAU_KHAC,
                                                model.NGUOI_KHAC,
                                                model.SO_NGUOI_CHET,
                                                model.SO_NGUOI_MAT_TICH

                                                );

                this.Information(String.Format(Constants.NOTIFY_UPDATE_SUCCESS, "bản ghi"));
                return(RedirectToAction("Index"));
            }

            return(View(model));
        }
Пример #2
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var kt_thiethai = KT_THIETHAIKHAITHACManager.GetByID(id);

            var model = new ViewModelEditKT_THIETHAIKHAITHAC()
            {
                ID                = kt_thiethai.ID,
                SO_DK_TAU         = kt_thiethai.SO_DK_TAU,
                SO_THUYENVIEN     = kt_thiethai.SO_THUYENVIEN,
                KHUVUC_GAPNAN     = kt_thiethai.KHUVUC_GAPNAN,
                TG_GAPNAN         = kt_thiethai.TG_GAPNAN,
                COQUAN_XULY       = kt_thiethai.COQUAN_XULY,
                THIETHAI_UOCTINH  = kt_thiethai.THIETHAI_UOCTINH,
                NGUOI_KHAC        = kt_thiethai.NGUOI_KHAC,
                TAU_KHAC          = kt_thiethai.TAU_KHAC,
                VIDO              = kt_thiethai.VIDO,
                KINHDO            = kt_thiethai.KINHDO,
                SO_NGUOI_CHET     = kt_thiethai.SO_NGUOI_CHET,
                SO_NGUOI_MAT_TICH = kt_thiethai.SO_NGUOI_MAT_TICH
            };

            var SUCOVETAU    = KT_THIETHAIKHAITHACManager.GetSUCOVETAUByID(id);
            var allSucovetau = KT_THIETHAIKHAITHACManager.GetAllSUCOVETAU();
            var checkBoxListItemsSUCOVETAU = new List <CheckBoxListItem>();

            foreach (var sucovetau in allSucovetau)
            {
                checkBoxListItemsSUCOVETAU.Add(new CheckBoxListItem()
                {
                    ID      = sucovetau.ID,
                    Display = sucovetau.Name,
                    //We should have already-selected genres be checked
                    IsChecked = SUCOVETAU.Where(x => x.ID == sucovetau.ID).Any()
                });
            }
            model.SUCOVETAU = checkBoxListItemsSUCOVETAU;
            //su co ve nguoi
            var SUCOVENGUOI    = KT_THIETHAIKHAITHACManager.GetSUCOVENGUOIByID(id);
            var allSucovenguoi = KT_THIETHAIKHAITHACManager.GetAllSUCOVENGUOI();
            var checkBoxListItemsSUCOVENGUOI = new List <CheckBoxListItem>();

            foreach (var sucovenguoi in allSucovenguoi)
            {
                checkBoxListItemsSUCOVENGUOI.Add(new CheckBoxListItem()
                {
                    ID      = sucovenguoi.ID,
                    Display = sucovenguoi.Name,
                    //We should have already-selected genres be checked
                    IsChecked = SUCOVENGUOI.Where(x => x.ID == sucovenguoi.ID).Any()
                });
            }
            model.SUCOVENGUOI = checkBoxListItemsSUCOVENGUOI;

            return(View(model));
        }