示例#1
0
        public ActionResult Decline(Guid id)
        {
            var timeRecordId = new TimeRecordId(id);
            var command      = new DeclineTimeRecord(timeRecordId);

            _commandSender.Send(command);

            return(RedirectToAction("Index"));
        }
示例#2
0
        /// <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));
        }
示例#3
0
        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));
        }