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

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

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

            //生成Model数据
            PositionSystem position = new PositionSystem();
            Position data = position.LoadPosition(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText);
            if (data == null)
            {
                throw new Exception(strErrText);
            }

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

            return View(model);
        }