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.")); } }
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."); } }
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); }
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; }