Esempio n. 1
0
        public ActionResult AjaxForm()
        {
            var districtModel = new System_District
            {
                IsShow = true
            };

            if (DoAction == ActionType.Edit)
            {
                districtModel = _districtDa.GetById(ArrId.FirstOrDefault());
            }

            ViewBag.DistrictCityID = _cityDa.GetAll();
            ViewData.Model         = districtModel;
            ViewBag.Action         = DoAction;
            ViewBag.ActionText     = ActionText;
            return(View());
        }
Esempio n. 2
0
        public ActionResult Update(string key, string code)
        {
            var msg = new JsonMessage(false, "Cập nhật dữ liệu thành công.");

            try
            {
                if (key != Keyapi)
                {
                    return(Json(0, JsonRequestBehavior.AllowGet));
                }
                var model = _da.GetById(ItemId);
                UpdateModel(model);
                _da.Save();
            }
            catch (Exception ex)
            {
                msg.Erros   = true;
                msg.Message = "Dữ liệu chưa được cập nhật.";
            }
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }