예제 #1
0
        /// <summary>
        /// Adds the time entry.
        /// </summary>
        /// <param name="entry">The entry.</param>
        /// <param name="username">The username.</param>
        /// <returns>IOpResult.</returns>
        public IOpResult AddTimeEntry(TimeEntry entry, string username)
        {
            // Get the User Id
            var userEntity = _db.GetUser(username);

            if (userEntity == null)
            {
                throw new ArgumentException(Resources.InvalidUserIdMessage);
            }
            entry.UserId    = userEntity.UserId;
            entry.CreatedBy = username;
            entry.CreatedAt = DateTime.Now;
            return(_db.AddTimeEntry(entry, username));
        }