public ActionResult Edit(CustomPermissionsModel model) { if (ModelState.IsValid) { if (customPermissionsService.AlreadyExists(model.Name, model.MenuId, model.Id)) { ModelState.AddModelError("Name", "自定义权限名重复"); } else { var customPermission = customPermissionsService.Get(model.Id); //忽略更新 model.CreateDate = customPermission.CreateDate; model.MenuId = customPermission.MenuId; customPermission = model.ToEntity(customPermission); customPermissionsService.Modify(customPermission); return(Json(new AjaxResult() { Result = Result.Success })); } } return(View(model)); }
public ActionResult Create(Guid?id) { CustomPermissionsModel model = new CustomPermissionsModel(); if (id.HasValue) { model.MenuId = id; } return(View(model)); }
public ActionResult Create(CustomPermissionsModel model) { if (ModelState.IsValid) { if (customPermissionsService.AlreadyExists(model.Name, model.MenuId, Guid.Empty)) { ModelState.AddModelError("Name", "权限名重复"); } else { customPermissionsService.Add(model.ToEntity()); return(Json(new AjaxResult() { Result = Result.Success })); } } return(View(model)); }
public static CustomPermissions ToEntity(this CustomPermissionsModel model, CustomPermissions destination) { return(model.MapTo(destination)); }
public static CustomPermissions ToEntity(this CustomPermissionsModel model) { return(Mapper.Map <CustomPermissionsModel, CustomPermissions>(model)); }