public async Task <ActionResult <BrandViewModel> > PostAsync([FromBody] CreateUpdateBrandViewModel pe) { _logger.LogDebug("Post {0}", pe.Brand); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var result = await _repository.CreateBrandAsync(pe.Brand); if (!result) { return(BadRequest(new ProblemDetails() { Detail = result.Message })); } return(CreatedAtRoute("Brand" + nameof(GetAsync), new { id = result.Data.BrandId }, _mapper.Map <BrandViewModel>(result.Data))); }