public async Task <IActionResult> PostCategory(ClientCategory category) { var logicValidation = new LogicValidations(); var categoryFromDatabase = await _DominiRepository.PostClientCategory(category); if (logicValidation.IsNotNull(categoryFromDatabase)) { var categoryDTO = new CategoriesDTO(categoryFromDatabase); return(Ok(categoryDTO)); } else { return(BadRequest()); } }
public async Task <IActionResult> PostCategory(CategoriesDTO model) { ClientCategory newClientCategory = new ClientCategory() { CategoryName = model.CategoryName, Active = model.Active }; ClientCategory categoryFromDatabase = await _bdRepository.PostClientCategory(newClientCategory); if (logicValidations.ValidateIfDataIsNotNull(categoryFromDatabase)) { model.CategoryId = categoryFromDatabase.CategoryId; return(Ok(model)); } return(BadRequest()); }