예제 #1
0
 public IActionResult ConfirmDelete(Guid id, Guid departmentId)
 {
     if (ModelState.IsValid)
     {
         var command = new DeleteCommitteeCommand(id, departmentId);
         _commandService.Handle(command);
         return(RedirectToAction("Details", "Department", new { id = departmentId }).WithSuccess("Committee deleted successfully."));
     }
     else
     {
         return(RedirectToAction("Delete", new { id, departmentId }).WithError("An error occured."));
     }
 }
예제 #2
0
 public IActionResult ConfirmDelete(Guid id, Guid departmentId)
 {
     if (ModelState.IsValid)
     {
         var command = new DeleteCommitteeCommand(id, departmentId);
         _commandService.Handle(command);
         return RedirectToAction("Details", "Department", new { id = departmentId }).WithSuccess("Committee deleted successfully.");
     }
     else
     {
         return RedirectToAction("Delete", new { id, departmentId }).WithError("An error occured.");
     }
 }
예제 #3
0
        public IEnumerable <IEvent> Handle(DeleteCommitteeCommand cmd)
        {
            if (cmd == null)
            {
                throw new ArgumentNullException(nameof(cmd));
            }
            if (cmd.AggregateId == Guid.Empty)
            {
                throw new ArgumentException(nameof(cmd.AggregateId));
            }
            if (cmd.CommitteeId == Guid.Empty)
            {
                throw new ArgumentException(nameof(cmd.CommitteeId));
            }

            var events = new List <IEvent>();

            events.Add(new DeleteCommitteeEvent(cmd.CommitteeId));
            return(events);
        }
예제 #4
0
        public IEnumerable<IEvent> Handle(DeleteCommitteeCommand cmd)
        {
            if (cmd == null)
                throw new ArgumentNullException(nameof(cmd));
            if (cmd.AggregateId == Guid.Empty)
                throw new ArgumentException(nameof(cmd.AggregateId));
            if (cmd.CommitteeId == Guid.Empty)
                throw new ArgumentException(nameof(cmd.CommitteeId));

            var events = new List<IEvent>();
            events.Add(new DeleteCommitteeEvent(cmd.CommitteeId));
            return events;
        }