public ActionResult Details(string id) { Papel papel = InternoRoleManager.FindById(id); string[] memberIDs = papel.Users.Select(x => x.UserId).ToArray(); IEnumerable <Usuario> membros = InternoUserManager.Users.Where(x => memberIDs.Any(y => y == x.Id)); return(View(new PapelDetailsModel { Role = papel, Membros = membros })); }
public ActionResult Delete(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Papel papel = InternoRoleManager.FindById(id); if (papel == null) { return(HttpNotFound()); } return(View(papel)); }
public ActionResult Edit(PapelViewModel pvm) { if (ModelState.IsValid) { Papel papel = InternoRoleManager.FindById(pvm.Id); papel.Name = pvm.Nome; IdentityResult resultado = InternoRoleManager.Update(papel); if (resultado.Succeeded) { return(RedirectToAction("Index")); } else { AddErrorsFromResult(resultado); } } return(View(pvm)); }
public ActionResult Edit(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Papel papel = InternoRoleManager.FindById(id); if (papel == null) { return(HttpNotFound()); } var pvm = new PapelViewModel(); pvm.Id = papel.Id; pvm.Nome = papel.Name; return(View(pvm)); }
public ActionResult Create(PapelViewModel model) { if (ModelState.IsValid) { Papel papel = new Papel { Name = model.Nome }; IdentityResult resultado = InternoRoleManager.Create(papel); if (resultado.Succeeded) { return(RedirectToAction("Index")); } else { AddErrorsFromResult(resultado); } } return(View(model)); }
public ActionResult Delete(Papel papel) { Papel p = InternoRoleManager.FindById(papel.Id); if (p != null) { IdentityResult resultado = InternoRoleManager.Delete(p); if (resultado.Succeeded) { return(RedirectToAction("Index")); } else { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } } else { return(HttpNotFound()); } }