public async Task<ActionResult> Agregar(AccionViewModel roleViewModel) { if (ModelState.IsValid) { var role = new ApplicationRole(roleViewModel.Name); var roleresult = await RoleManager.CreateAsync(role); if (!roleresult.Succeeded) { ModelState.AddModelError("", roleresult.Errors.First()); return View(); } return RedirectToAction("Index"); } return View(); }
// // GET: /Roles/Edit/Admin public async Task<ActionResult> Editar(string id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } var role = await RoleManager.FindByIdAsync(id); if (role == null) { return HttpNotFound(); } AccionViewModel roleModel = new AccionViewModel { Id = role.Id, Name = role.Name }; return View(roleModel); }