Exemplo n.º 1
0
 public IActionResult Create(CommitteeViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
         var command = Mapper.Map <NewCommitteeCommand>(viewModel);
         _commandService.Handle(command);
         return(RedirectToAction("Details", "Department", new { id = viewModel.DepartmentId }).WithSuccess("Committee created successfully."));
     }
     else
     {
         return(View(viewModel).WithError("Validation error occured."));
     }
 }
Exemplo n.º 2
0
 public IActionResult Create(DepartmentViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
         var command = Mapper.Map <NewDepartmentCommand>(viewModel);
         _commandService.Handle(command);
         return(RedirectToAction("Index").WithSuccess("Department created successfully."));
     }
     else
     {
         return(View(viewModel).WithError("Validation error occured."));
     }
 }