public IActionResult CreateSubCategory(SubCategoryForCreationDTO model, int id) { if (!ModelState.IsValid) { return(BadRequest(Messages.ModelNullOrEmpty)); } var subCategory = new SubCategory { SubCategoryName = model.SubCategoryName, CategoryId = id }; _subCategoryService.Create(subCategory); return(Ok()); }
public IHttpActionResult CreateSubCategory(SubCategoryForCreationDTO model, int id) { model.CategoryId = id; var subCategory = new SubCategory { SubCategoryName = model.SubCategoryName, CategoryId = model.CategoryId }; if (ModelState.IsValid) { _subCategoryRepository.Add(subCategory); return(Ok()); } return(BadRequest(ModelState)); }