Пример #1
0
        public ActionResult Create(MemberViewModel model)
        {
            ServiceResult result = new ServiceResult();
            if (ModelState.IsValid)
            {
                try
                {
                    MemberService.Create(model);
                    result.Message = "添加操作成功!";
                    LogHelper.WriteLog("添加操作成功");
                }
                catch (Exception ex)
                {
                    result.Message = Utilities.GetInnerMostException(ex);
                    result.AddServiceError(result.Message);
                    LogHelper.WriteLog("添加操作错误", ex);
                }
            }
            else
            {
                result.Message = "请检查表单是否填写完整!";
                result.AddServiceError("请检查表单是否填写完整!");

            }

            return Json(result);
        }
Пример #2
0
 public ActionResult Create()
 {
     var model = new MemberViewModel();
     ViewBag.Data_GroupID = Utilities.GetSelectListData(
         GroupService.GetALL(), x => x.ID, x => x.Name);
     return PartialView(model);
 }
Пример #3
0
 public Member Update(MemberViewModel model)
 {
     var entity = Find(model.ID);
     db.Attach<Member>(entity);
     entity.Name = model.Name;
     entity.Password = model.Password;
     entity.GroupID = model.GroupID;
     db.Commit();
     return entity;
 }
Пример #4
0
 public Member Create(MemberViewModel model)
 {
     var entity = new Member();
     entity.Name = model.Name;
     entity.Password = model.Password;
     entity.GroupID = model.GroupID;
     db.Add<Member>(entity);
     db.Commit();
     return entity;
 }
Пример #5
0
 public ActionResult Edit(int ID)
 {
     var entity = MemberService.Find(ID);
     var model = new MemberViewModel()
     {
         ID = entity.ID,
         Name = entity.Name,
         GroupID = entity.GroupID
     };
     ViewBag.Data_GroupID = Utilities.GetSelectListData(
        GroupService.GetALL(), x => x.ID, x => x.Name, model.GroupID);
     return PartialView(model);
 }