public ActionResult Create(RoleEntry model) { var info = _role.GetByCode(model.RoleCode); if (info != null && info.RoleCode == model.RoleCode) { ModelState.AddModelError("RoleCode", string.Format("{0} has been used, please change one.", "Action Code")); } if (ModelState.IsValid) { model.CreatedBy = Utility.CurrentUserName; model.CreatedTime = DateTime.UtcNow; Utility.Operate(this, Operations.Add, () => { _cache.Remove(Constants.CACHE_KEY_ROLES); return(_role.Add(model)); }, model.DisplayName); } else { Utility.SetErrorModelState(this); } return(Redirect("~/Admin/Roles/Index")); }
public IActionResult AddRole(Role role) { var checkPerson = _roleRepo.Read(role.Id); if (checkPerson == null) { _roleRepo.Add(role); return RedirectToAction("Index", "Roles"); } return View(); }
public ActionResult Create(Role role) { if (getCurrentUser() == null) { return(RedirectToAction("Index", "Login")); } else { try { role.r_active_yn = "Y"; role.r_cre_by = getCurrentUser().u_id; role.r_cre_date = DateTime.Now; irole.Add(role); return(RedirectToAction(nameof(Index))); } catch { return(View()); } } }
public IActionResult Save(RoleViewModel model) { if (ModelState.IsValid) { var department = new Role { Id = model.Id, Description = model.Description, }; if (model.Id.ToString().Length <= 0) { _Role.Add(department); } else { _Role.Update(department); } return(RedirectToAction("Index")); } else { return(View()); } }
/// <summary> /// create a new role /// </summary> /// <param name="entity">ApplicationRole</param> /// <returns>notification object {messagge = "carry the message to communicate to the user", Success = true or false}</returns> public Notification Add(RoleViewModel entity) { return(_role.Add(entity)); }
public virtual void Add(bool addAll = false, Infastructure.ProgressReporter pg = null) { _role.Add(addAll, pg); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Library.Model.Role model) { return(dal.Add(model)); }
public void Add(Role objRole) { Roleobj.Add(objRole); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(E_Model.Role model) { return(dal.Add(model)); }