Exemple #1
0
        public async Task <ActionResult <ProjectResponse> > PutCompletedProject(int id, bool projectRequest)
        {
            try
            {
                var project = await projectClass.EditCompletedProject(id, projectRequest);

                if (project.Name == null)
                {
                    projectResponse = new ProjectResponse
                    {
                        StatusCode = 400,
                        Message    = "Invalid Id",
                    };
                    return(Ok(projectResponse));
                }
                else if (project.Completed == false && project.Flag == null)
                {
                    projectResponse = new ProjectResponse
                    {
                        StatusCode   = 400,
                        Message      = "Project is not completed yet, Complete the project first",
                        ResponseData = project
                    };
                    return(Ok(projectResponse));
                }
                else
                {
                    projectResponse = new ProjectResponse
                    {
                        StatusCode   = 200,
                        Message      = "Successfully Executed",
                        ResponseData = project
                    };
                    return(Ok(projectResponse));
                }
            }
            catch (Exception)
            {
                throw;
            }
        }