示例#1
0
        public void When_AddTask_Then_VerifyResult()
        {
            var taskModel = TestDataHelper.GetTask().Map();
            var task      = _mockProjectManagerService.AddTask(taskModel);

            Assert.NotNull(task);
        }
        public IHttpActionResult AddTask(TaskModel task)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            TaskModel oldTaskModel = pmService.GetTaskById(task.TaskId);

            if (oldTaskModel != null)
            {
                return(BadRequest());
            }
            var result = pmService.AddTask(task);

            if (result != null)
            {
                return(Ok());
            }
            return(BadRequest());
        }
 public IHttpActionResult AddTask([FromBody] TaskEntity taskEntity)
 {
     return(Ok(projectManagerService.AddTask(taskEntity)));
 }