public Category CreateCategory(RequestCreateCategory model) { var entity = model.ToEntity(); PrepareCreate(entity); return(Add(entity)); }
public IActionResult CreateCategory([FromBody] RequestCreateCategory _category) { Category entity; if (ModelState.IsValid) { entity = _categoryServices.CreateCategory(_category); _categoryServices.Commit(); return(Created($"api/categories/{entity.Id}", _category)); } else { return(BadRequest()); } }