コード例 #1
0
        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} "));
        }
コード例 #2
0
        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."));
        }