public ActionResult <CategoryViewModel> Post(CategoryImputModel categoryInput) { CategoryProduct category = Map(categoryInput); var response = categoryService.Save(category); if (response.Error) { return(BadRequest(response.Message)); } return(Ok(response.Category)); }
private CategoryProduct Map(CategoryImputModel categoryInput) { var category = new CategoryProduct(); category.IdCategory = categoryInput.IdCategory; category.Name = categoryInput.Name; category.TypeProduct = new TypeProduct(); category.TypeProduct.IdType = categoryInput.TypeProduct.IdType; category.TypeProduct.Name = categoryInput.TypeProduct.Name; return(category); }