Exemplo n.º 1
0
        public ActionResult AddProject(ProjectEditModel viewModel)
        {
            if (ModelState.IsValid)
            {
                _clientService.AddProject(viewModel.ClientId, viewModel.Name, User.Identity.Name, DateTime.UtcNow);
                TempData.Add("SuccessMessage", "The project was created successfully");
                return RedirectToAction("Detail", "Client", new { @id = viewModel.ClientId });
            }

            return View(viewModel);
        }
Exemplo n.º 2
0
        public ActionResult EditProject(ProjectEditModel viewModel)
        {
            if (ModelState.IsValid)
            {
                _clientService.EditProject(viewModel.Id, viewModel.Name);
                TempData.Add("SuccessMessage", "The project was updated successfully");
                return RedirectToAction("Detail", "Client", new { @id = viewModel.ClientId });
            }

            return View(viewModel);
        }
Exemplo n.º 3
0
 public ActionResult AddProject(string id)
 {
     var client = Mapper.Map<ClientEditModel>(_clientService.GetById(id));
     var viewModel = new ProjectEditModel { ClientId = client.Id, ClientName = client.Name };
     return View(viewModel);
 }
Exemplo n.º 4
0
 public ActionResult DeleteProject(ProjectEditModel viewModel)
 {
     _matrixService.DeleteByProjectId(viewModel.Id);
     _clientService.DeleteProject(viewModel.Id);
     TempData.Add("SuccessMessage", "The project " + viewModel.Name + " was deleted successfully");
     return RedirectToAction("Detail", "Client", new { @id = viewModel.ClientId });
 }