public ActionResult Save(EditViewModel editViewModel) { if (ModelState.IsValid) { _rolesManagement.Save(editViewModel); } return View("Edit", editViewModel); }
private static Rol Map(EditViewModel editViewMode) { return new Rol { RolId = editViewMode.RolId, Name = editViewMode.RolName.ToUpper(), }; }
public ActionResult Create() { var editViewModel = new EditViewModel { RolId = 0, RolName = string.Empty, }; return View("Edit", editViewModel); }
public ActionResult Edit(int id) { var rolInformation = _rolesManagement.GetRol(id); var editViewModel = new EditViewModel { RolId = id, RolName = rolInformation.Name, }; return View(editViewModel); }
public void Save(EditViewModel editViewModel) { var rol = Map(editViewModel); if (editViewModel.RolId == 0) { AddRol(rol); } else { EditRol(rol); } }