public JsonResult CreateOrUpdate(PermissionDto model)
 {
     if (model.Id == 0)
     {
         this.Create(model);
     }
     else
     {
         this.Update(model);
     }
     return Json(1, JsonRequestBehavior.AllowGet);
 }
 public ActionResult Edit(int? id)
 {
     PermissionDto model = null;
     if (!id.HasValue)  //新建
     {
         model = new PermissionDto();
     }
     else  //编辑
     {
         model = _permissionService.GetById(id.Value);
     }
     return View(model);
 }
 public void Update(PermissionDto model)
 {
     var entity = _permissionRepository.GetById(model.Id);
     _permissionRepository.Update(model.MapTo(entity));
 }
 public void Create(PermissionDto model)
 {
     _permissionRepository.Insert(model.MapTo<Permission>());
 }
        public JsonResult Update(PermissionDto model)
        {
            _permissionService.Update(model);
            return Json(1, JsonRequestBehavior.AllowGet);

        }
Пример #6
0
        public void Update(PermissionDto model)
        {
            var entity = _permissionRepository.GetById(model.Id);

            _permissionRepository.Update(model.MapTo(entity));
        }
Пример #7
0
 public void Create(PermissionDto model)
 {
     _permissionRepository.Insert(model.MapTo <Permission>());
 }