public ActionResult Decline(Guid id) { var timeRecordId = new TimeRecordId(id); var command = new DeclineTimeRecord(timeRecordId); _commandSender.Send(command); return(RedirectToAction("Index")); }
/// <summary> /// Handles the specified <see cref="DeclineTimeRecord"/>command. /// </summary> /// <param name="command">The command.</param> /// <exception cref="System.ArgumentNullException">When TimeRecordId is null.</exception> public void Handle(DeclineTimeRecord command) { if (command.Id == null) { throw new ArgumentNullException("TimeRecordId", "TimeRecordId must be specified."); } var timeRecord = this.timeRecordRepository.Get(command.Id); timeRecord.DeclineTimeRecord(); this.timeRecordRepository.Save(timeRecord); }