예제 #1
0
        public Project GetProjectByID(int Id)
        {
            ProjectRepo projectRepository = new ProjectRepo();
            Project     project           = projectRepository.GetProjectById(Id);

            return(project);
        }
예제 #2
0
        public HttpResponseMessage EditProjectDetails(Project project)
        {
            HttpResponseMessage response = null;

            try
            {
                if (project != null)
                {
                    Project existingInstance = ProjectRepo.GetProjectById(project.id);
                    if (existingInstance != null)
                    {
                        ProjectRepo.EditProject(project);
                        response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Project details Updated successfully!", "Project details Updated successfully!"));
                    }
                    else
                    {
                        response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_204", "Project ID doesnot exists", "Invalid Project ID"));
                    }
                }
                else
                {
                    response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_102", "Invalid Input", "Please check input Json"));
                }
            }
            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);
        }
예제 #3
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);
        }