public IActionResult AddCategory(AddCategoryInputModel input) { if (!input.IsValid()) { return(BadRequest(input.ValidationMessage)); } var category = _categoryAppService.AddCategory(input); return(Created(new Uri($"{Request.Path}/{category.Id}", UriKind.Relative), category)); }
public async Task <IActionResult> Add([FromBody] CategoryViewModel categoryViewModel) { var data = await _categoryAppService.AddCategory(categoryViewModel); if (data.ValidationResult.IsValid) { return(Ok(data)); } return(BadRequest(data)); }