public ActionResult <BaseViewModel <ProductCategoryViewModel> > PostProductCategory(CreateProductCategoryRequestViewModel request) { var result = _producCategorytService.CreateProductCategory(request); this.HttpContext.Response.StatusCode = (int)result.StatusCode; return(result); }
public async Task <IActionResult> Create([FromForm] CategoryCreateViewModel viewModel) { var result = await _category.CreateProductCategory(viewModel); var category = await _category.GetCategoryById(result); return(new OkObjectResult(category)); }
public ActionResult Create(ProductCategoryFormModel obj, bool continueEditing) { if (ModelState.IsValid) { obj.Slug = StringConvert.ConvertShortName(obj.Name); var item = Mapper.Map <ProductCategoryFormModel, ProductCategory>(obj); _productCategoryService.CreateProductCategory(item); return(continueEditing ? RedirectToAction("Edit", "ProductCategory", new { id = item.Id }) : RedirectToAction("Index", "ProductCategory")); } else { return(View("Create", obj)); } }
public ActionResult Create(ProductCategoryViewModel productCVM) { if (ModelState.IsValid) { var productCategory = new ProductCategory(); productCategory.Name = productCVM.Name; productCategory.Slug = productCVM.Slug; productCategory.Description = productCVM.Description; productCategory.ParentCategoryId = productCVM.ParentCategoryId; productCategoryService.CreateProductCategory(productCategory); productCategoryService.SaveProductCategory(); return(RedirectToAction("Index")); } ViewBag.ProductCategories = new SelectList(productCategoryService.GetProductCategories(), "Id", "Name", productCVM.ParentCategoryId); return(View(productCVM)); }
public IActionResult CreateProductCategory(ProductCategoryRequestDTO request) { _service.CreateProductCategory(request); return(RedirectToAction("Index")); }