public HttpResponse Add(IssueFormViewModel model, string carId) { var errors = IssueService.AddNewIssue(model, carId); if (errors.Count != 0) { return(Error(errors)); } return(Redirect($"/Issues/CarIssues?carId={carId} ")); }
public async Task <IActionResult> AddNewIssue(NewIssueDto newIssue) { if (!ModelState.IsValid) { return(BadRequest("Model state is not valid.")); } if (await issueService.AddNewIssue(newIssue)) { return(Ok()); } return(BadRequest("Something goes wrong.")); }