Ejemplo n.º 1
0
        /// <summary>
        /// Posts the work details.
        /// </summary>
        /// <param name="taskDetail">The work detail.</param>
        /// <returns>
        /// HttpResponse Message
        /// </returns>
        public HttpResponseMessage PostTaskDetail(TaskDetail taskDetail)
        {
            if (taskDetail != null)
            {
                var workDetail = MapWorkDetails(taskDetail);
                if (workDetail != null)
                {
                    var taskDetails = new TaskDetails();
                    taskDetails.TotalTimesheetHours = this.timesheetService.Insert(workDetail, taskDetail.ApplicationType);
                    return Request.CreateResponse(HttpStatusCode.Created, taskDetails);
                }
            }

            return Request.CreateResponse(HttpStatusCode.BadRequest);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the timesheet hours.
        /// </summary>
        /// <param name="taskDetail">The task detail.</param>
        /// <returns>
        /// The Total Timesheet Hours for the day
        /// </returns>
        private static WorkDetail MapWorkDetails(TaskDetail taskDetail)
        {
            var workDetail = new WorkDetail
            {
                ProjectID = taskDetail.ProjectId,
                CategoryID = taskDetail.CategoryId,
                FeatureID = taskDetail.FeatureId,
                DeveloperID = taskDetail.DeveloperId,
                Date = taskDetail.Date,
                HoursReported = taskDetail.HoursReported,
                Description = taskDetail.Description,
                Comments = taskDetail.Comments,
                ClientDependencyFlag = taskDetail.ClientDependencyFlag
            };

            return workDetail;
        }