public async Task <IActionResult> AddApiResourceScopeAsync(string subject, ApiResourceScopeValue model) { if (string.IsNullOrWhiteSpace(subject)) { ModelState["subject.String"].Errors.Clear(); ModelState.AddModelError("", Messages.SubjectRequired); } if (model == null) { ModelState.AddModelError("", Messages.ApiResourceScopeNeeded); } if (ModelState.IsValid) { var result = await _service.AddScopeAsync(subject, model.Name); if (result.IsSuccess) { return(NoContent()); } ModelState.AddErrors(result); } return(BadRequest(ModelState.ToError())); }