Ejemplo n.º 1
0
 public IHttpActionResult Updateproject(statusedProjectDTO projectInput)
 {
     try
     {
         projRepo.updateProject(projectInput);
         return(Ok("Project updated"));
     }
     catch (Exception e)
     {
         return(Content(HttpStatusCode.BadRequest, e.Message));
     }
 }
Ejemplo n.º 2
0
        //update project status, project information cannot be changed
        public void updateProject(statusedProjectDTO projectInput)
        {
            try
            {
                project p = db.projects.Find(projectInput.id);
                p.status = projectInput.status;

                foreach (item i in db.items.ToList().Where(i => i.p_id == projectInput.id))
                {
                    i.status = projectInput.status;
                }

                db.SaveChanges();
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
Ejemplo n.º 3
0
        public void UpdateProject()
        {
            //Arrange
            statusedProjectDTO updatedProject = new statusedProjectDTO
            {
                id     = 1,
                status = "open",
            };

            //Act
            var result = controller.Updateproject(updatedProject) as OkNegotiatedContentResult <string>;

            //Assert
            Assert.IsNotNull(result);
            Assert.AreEqual("Project updated", result.Content);

            //Cleanup
            updatedProject.status = "released";
            controller.Updateproject(updatedProject);
        }