public async Task <IActionResult> CreateType(ProductTypeCreateInputModel productTypeCreateInputModel) { ProductTypeServiceModel productTypeServiceModel = mapper.Map <ProductTypeServiceModel>(productTypeCreateInputModel); await this.productService.CreateProductType(productTypeServiceModel); return(this.Redirect("/")); }
public async Task <IActionResult> CreateType(ProductTypeCreateInputModel model) { ProductTypeServiceModel productType = new ProductTypeServiceModel { Name = model.Name }; await this.productService.CreateProductType(productType); return(this.Redirect("/")); }
public async Task <IActionResult> Create(ProductTypeCreateInputModel model) { if (!this.ModelState.IsValid) { return(this.View(model)); } await this.productTypeService.CreateAsync(model.Name); return(this.RedirectToAction(nameof(this.Index))); }
public async Task <IActionResult> CreateType(ProductTypeCreateInputModel productTypeCreateInputModel) { if (!ModelState.IsValid) { return(this.View(productTypeCreateInputModel)); } //for one it is not worth it? ProductTypeServiceModel productTypeServiceModel = new ProductTypeServiceModel { Name = productTypeCreateInputModel.Name }; await this.productService.CreateProductType(productTypeServiceModel); return(this.Redirect("/")); }