public ActionResult CreateRole(tbl_MCE_Role mce_role) { _role.AddRole(mce_role); TempData["Success"] = "Data Inserted Successfully"; ModelState.Clear(); return(View()); }
public ActionResult <Role> AddRole(Role role) { var verifiLibelle = _roleData.GetRoleByLibelle(role.Libelle); if (verifiLibelle == null) { _roleData.AddRole(role); _roleData.SaveChanges(); return(CreatedAtRoute(nameof(GetRoleById), new { Id = role.Id }, role)); } else { return(NotFound($"Un role avec le libelle : {role.Libelle} existe déjà")); } }
public ActionResult <Role> AddRole([FromBody] Role value) { Task <Role> data = role.AddRole(value); if (data.IsCanceled) { return(BadRequest(data.Exception)); } else if (data.Result == null) { return(NoContent()); } else { return(Ok(data.Result)); } }
public ActionResult Create(Registration registration) { var isEmailExist = Iregistration.CheckEmailExists(registration.Email); if (isEmailExist) { ModelState.AddModelError("", errorMessage: "Email Already used!! Try Unique One"); } else { if (ModelState.IsValid) { Iregistration.AddUser(registration); int userid = databaseContext.Registrations.Max(x => x.UserId); Irole.AddRole(userid); return(RedirectToAction("Index", "Home")); } } return(View()); }
public bool AddRole(Roles role) { return(dll.AddRole(role)); }
public void AddRole(Role r) { RoleInterface.AddRole(r); }