public ActionResult Decline(Guid id) { var timeRecordId = new TimeRecordId(id); var command = new DeclineTimeRecord(timeRecordId); _commandSender.Send(command); return(RedirectToAction("Index")); }
/// <summary> /// Gets the specified identifier. /// </summary> /// <param name="id">The time record identifier.</param> /// <exception cref="System.ArgumentNullException">When id is null.</exception> public TimeRecord Get(TimeRecordId id) { if (id == null) { throw new ArgumentNullException("id"); } return(this.context.TimeRecords.Find(id.Id)); }
private TimeRecord GetOrCreateTimeRecord(TimeRecordId id) { var project = this.timeRecordRepository.Get(id); if (project != null) { throw new ArgumentException(string.Format("Time record with such id: {0} exist in the system.", id.Id)); } return(new TimeRecord(id)); }