Пример #1
0
        public HttpResponseMessage AssignProjectTask(List <Task> task)
        {
            HttpResponseMessage response = null;

            try
            {
                if (task != null)
                {
                    foreach (Task items in task)
                    {
                        Project proj_details = ProjectRepo.GetProjectById(items.project_id);
                        if (proj_details != null)
                        {
                            TaskRepo.AssignProjectTask(items);
                            response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Tasks assigned successfully", "Tasks assigned successfully"));
                        }
                        else
                        {
                            response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_204", "Project ID doesnot Exists", "Project ID doesnot Exists"));
                        }
                    }
                }
                else
                {
                    response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_102", "Invalid Input", "Please check input Json"));
                }
            }
            catch (DbEntityValidationException DBexception)
            {
                Debug.WriteLine(DBexception.Message);
                Debug.WriteLine(DBexception.GetBaseException());
                response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_190", "Mandatory fields missing", DBexception.Message));
            }
            catch (Exception exception)
            {
                Debug.WriteLine(exception.Message);
                Debug.WriteLine(exception.GetBaseException());
                response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_101", "Application Error", exception.Message));
            }
            return(response);
        }