public ActionResult Delete(ClientEditModel viewModel) { var client = Mapper.Map<ClientViewModel>(_clientService.GetById(viewModel.Id)); client.Projects.Each(p => _matrixService.DeleteByProjectId(p.Id)); _clientService.Delete(viewModel.Id); TempData.Add("SuccessMessage", "The client " + viewModel.Name + " was deleted successfully"); return RedirectToAction("Index"); }
public ActionResult Add(ClientEditModel viewModel) { if (ModelState.IsValid) { _clientService.Add(viewModel.Name, User.Identity.Name, DateTime.UtcNow); TempData.Add("SuccessMessage", "The new client was created successfully"); return RedirectToAction("Index"); } return View(viewModel); }
public ActionResult Edit(ClientEditModel viewModel) { if (ModelState.IsValid) { _clientService.Edit(viewModel.Id, viewModel.Name); TempData.Add("SuccessMessage", "The client " + viewModel.Name + " was updated successfully"); return RedirectToAction("Index"); } return View(viewModel); }