public void Test_For_AddTask()
        {
            // Arrange
            var userGuid   = Guid.NewGuid();
            var testTaskVM = new Models.ViewModels.Task()
            {
                TaskName = "TestTask1", Priority = 20, ProjectName = "TestProject100", OwnerFullName = "First Last", StartDate = DateTime.Today
            };
            var testTaskDM = new Models.DataModels.Task()
            {
                TaskName    = "TestTask1",
                Priority    = 20,
                ProjectId   = 100,
                TaskOwnerId = userGuid,
                StartDate   = DateTime.Today,
                Project     = new Models.DataModels.Project()
                {
                    ProjectId = 100, ProjectName = "TestProject100", Priority = 1, ManagerId = userGuid
                },
                TaskOwner = new Models.DataModels.User()
                {
                    Id = userGuid, UserId = "TestUser1", FirstName = "First", LastName = "Last"
                }
            };

            mockTaskRepo.Setup(repo => repo.Create(It.IsAny <Models.DataModels.Task>())).Returns(testTaskDM);
            // Act
            var actualTask = tasksLogicTest.CreateTask(testTaskVM);

            // Assert
            Assert.NotNull(actualTask);
            Assert.Equal(testTaskVM.ProjectName, actualTask.ProjectName);
            Assert.Equal(testTaskVM.OwnerFullName, actualTask.OwnerFullName);
        }
        public IActionResult CreateTask([FromBody] CreateTaskRequest request)
        {
            var task = _taskLogic.CreateTask(request);

            if (task == true)
            {
                return(Ok());
            }

            return(NotFound());
        }
 public IActionResult Post([FromBody] Task value)
 {
     if (ModelState.IsValid)
     {
         try
         {
             var result = taskLogic.CreateTask(value);
             //var createdUrl = string.Join("/", Request.Path, result.TaskId);
             return(Created(string.Concat("/", result.TaskId), result));
         }
         catch (Exception ex)
         {
             _logger.LogError(ex, $"Error during Creating new Task with value - {value.Stringify()}");
             return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message));
         }
     }
     else
     {
         _logger.LogWarning("Invalid/Incomplete Task Information - {0}", value.Stringify());
         return(BadRequest(ModelState)); //"Invalid request information. Please verify the information entered.",
     }
 }