private static IdentificationType Map(EditViewModel editViewMode) { return new IdentificationType { IdentificationTypeId = editViewMode.IdentificationTypeId, IdentificationDescription = editViewMode.Description.ToUpper(), }; }
public ActionResult Create() { var editViewModel = new EditViewModel { IdentificationTypeId = 0, Description = string.Empty, }; return View("Edit", editViewModel); }
public ActionResult Save(EditViewModel editFormModel) { if (ModelState.IsValid) { _identificationTypesManagement.Save(editFormModel); return RedirectToAction("Index"); } return View("Edit", editFormModel); }
public ActionResult Edit(int id) { var identificationType = _identificationTypesManagement.GetIdentificationType(id); var editViewModel = new EditViewModel { IdentificationTypeId = identificationType.IdentificationTypeId, Description = identificationType.IdentificationDescription, }; return View(editViewModel); }
public void Save(EditViewModel editViewModel) { var identificationType = Map(editViewModel); if (editViewModel.IdentificationTypeId.Equals(0)) { AddIdentificationType(identificationType); } else { EditIdentificationType(identificationType); } }