public async Task <IActionResult> ProductThickness(int productThicknessID, int productAttributeThicknessID, string productThickness) { ProductAttributeThicknessViewModel _productAttributeThickness; if (productAttributeThicknessID == 0) { _productAttributeThickness = new ProductAttributeThicknessViewModel { ProductThicknessName = productThickness, ProductThicknessID = productThicknessID, ProductWidthList = GetProductWidths() } } ; else { _productAttributeThickness = await generateAPIResponse.ProductAttributeThicknessViewRepo.GetByID("ProductAttributeThickness", productAttributeThicknessID); _productAttributeThickness.ProductThicknessName = productThickness; _productAttributeThickness.ProductWidthList = GetProductWidths(); } return(PartialView("_ProductThickness", _productAttributeThickness)); }
public async Task <IActionResult> SaveProductAttributeThickness(ProductAttributeThicknessViewModel model) { try { var response = false; // Call Post Method to Create New Product Attribute Details if (model.FormAction.ToLower() == "create") { model = await generateAPIResponse.ProductAttributeThicknessViewRepo.SaveModel("ProductAttributeThickness", model); if (model.ProductAttributeThicknessID != 0) { response = true; } } // Call Put Method to Update Existing Product Attribute Details else { response = await generateAPIResponse.ProductAttributeThicknessViewRepo.Update("ProductAttributeThickness/" + model.ProductAttributeThicknessID, model); } if (response) { return(Ok(model.ProductAttributeThicknessID)); } else { ViewBag.Message = null; } } catch (Exception ex) { ViewBag.Message = "Something went wrong: " + ex.Message; } return(StatusCode(500)); }