Exemple #1
0
        public ActionResult NewCountry()
        {
            //创建空的Model
            CountryViewModel model = new CountryViewModel();

            return View(model);
        }
Exemple #2
0
        public ActionResult NewCountry(CountryViewModel model)
        {
            if (ModelState.IsValid)
            {
                //创建数据
                Country data = new Country();
                data.Name = model.Name;
                data.Remark = model.Remark ?? string.Empty;

                //保存数据
                string strErrText;
                DDSystem country = new DDSystem();
                if (country.InsertCountry(data, LoginAccountId, LoginStaffName, out strErrText))
                {
                    return Json(string.Empty);
                }
                else
                {
                    return Json(strErrText);
                }
            }
            return View(model);
        }
Exemple #3
0
        public ActionResult ModifyCountry(string id)
        {
            string strErrText;

            //生成Model数据
            DDSystem country = new DDSystem();
            Country data = country.LoadCountry(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText);
            if (data == null)
            {
                throw new Exception(strErrText);
            }

            CountryViewModel model = new CountryViewModel();
            model.Id = data.Id;
            model.Name = data.Name;
            model.Remark = data.Remark;

            return View(model);
        }