Example #1
0
        public IActionResult CreateTask([FromBody] TaskCreateUpdateRequestDto taskData)
        {
            if (ModelState.IsValid)
            {
                var task = _mapper.Map <Task>(taskData);

                var newTaskStatus = _taskStatusService.GetStatus(taskData.Status);
                if (newTaskStatus == null)
                {
                    return(NotFound(taskData.Status));
                }

                task.Status = newTaskStatus;
                _taskService.Create(task);
                return(Ok());
            }

            return(BadRequest(ModelState));
        }