public ActionResult Edit(Customer customer) { if (ModelState.IsValid) { ActionConfirmation<Customer> confirmation = _customerMgmtTasks.SaveOrUpdate(customer); if (confirmation.WasSuccessful) { TempData["message"] = confirmation.Message; return RedirectToAction("Index"); } ViewData["message"] = confirmation.Message; } return View(_customerMgmtTasks.CreateEditViewModel(customer)); }
private string HandleNewCustomer(Customer newCustomer, SupportTicket supportTicket) { if (newCustomer != null && newCustomer.IsTransient()) { // Validation should already have been enforced if (!DataAnnotationsValidator.TryValidate(newCustomer)) throw new InvalidOperationException("newCustomer is in an invalid state"); _customerRepository.SaveOrUpdate(newCustomer); supportTicket.Customer = newCustomer; return " The newCustomer with account number " + newCustomer.AccountNumber + " has been added."; } return null; }