예제 #1
0
 public IHttpActionResult EndTask([FromBody] ProjectMangerModel.Tasks task)
 {
     try
     {
         CommonEntities.Tasks tk = new CommonEntities.Tasks
         {
             TaskID = task.TaskID
         };
         _taskBL.EndTask(tk);
         return(Ok());
     }
     catch (Exception)
     {
         return(InternalServerError());
     }
 }
        public void AddTaskTest_Success()
        {
            // Arrange
            ProjectMangerModel.Tasks model = new ProjectMangerModel.Tasks
            {
                TaskID    = 5,
                Task      = "Task 5",
                ProjectID = 1,
                Priority  = 10,
                StartDate = DateTime.Now.Date,
                EndDate   = DateTime.Now.Date.AddDays(1)
            };

            // Act
            var response = taskController.AddTask(model);

            // Assert
            Assert.IsTrue(response is OkResult);
        }
        public void AddTaskTest_Error()
        {
            // Arrange
            var taskController = new TasksController(null);

            ProjectMangerModel.Tasks model = new ProjectMangerModel.Tasks
            {
                TaskID    = 5,
                Task      = "Task 5",
                ProjectID = 1,
                Priority  = 10,
                StartDate = DateTime.Now.Date,
                EndDate   = DateTime.Now.Date.AddDays(1)
            };

            // Act
            var response = taskController.AddTask(model);

            // Assert
            Assert.IsTrue(response is InternalServerErrorResult);
        }
예제 #4
0
        public IHttpActionResult AddTask([FromBody] ProjectMangerModel.Tasks task)
        {
            try
            {
                CommonEntities.Tasks tk = new CommonEntities.Tasks
                {
                    Task         = task.Task,
                    ProjectID    = task.ProjectID,
                    Priority     = task.Priority,
                    ParentTaskID = task.ParentTaskID,
                    StartDate    = task.StartDate,
                    EndDate      = task.EndDate,
                    UserID       = task.UserID
                };

                _taskBL.AddTasks(tk);
                return(Ok());
            }
            catch (Exception)
            {
                return(InternalServerError());
            }
        }