public IActionResult Create([FromBody] WBIVM wbiVM) { if (wbiVM.EstimatedHours <= 0) { return(new BadRequestObjectResult(new { message = "Estimated hours cannot be less than or equal to zero" })); } if (wbiVM.ProjectId == null || wbiVM.ProjectId == "") { return(new BadRequestObjectResult(new { message = "Please provide a ProjectId" })); } Guid result; bool success = Guid.TryParse(wbiVM.ProjectId, out result); if (success) { return(new OkObjectResult(wbiRepo.CreateWBI(wbiVM))); } return(new BadRequestObjectResult(new { message = "ProjectId must be parsed into a valid Guid" })); }
public IActionResult Create(string description, int estimatedHours, int actualHours, int projectId) { return(new OkObjectResult(wbiRepo.CreateWBI(description, estimatedHours, actualHours, projectId))); }