public ActionResult Create(string id) { Session[Config.DesignImage] = new List <ProductMultiUpload>(); Session[Config.MaterialImage] = new List <ProductMultiUpload>(); if (!string.IsNullOrWhiteSpace(id)) { shProductService _product = new shProductService(); shProduct product = _product.FindByKey(id); if (product != null) { shCategoryService _category = new shCategoryService(); ViewBag.citySel = _category.CategoryName(product.CategoryGuid); ViewBag.ProductGuid = product.ProductGuid; #region Image shProductImageService _productImage = new shProductImageService(); IEnumerable <shProductImage> DsDesignImage = _productImage.DanhSachProductImage_ByCategory(product.ProductGuid, Config.ProductImageCategory_Design); IEnumerable <shProductImage> DsMaterialImage = _productImage.DanhSachProductImage_ByCategory(product.ProductGuid, Config.ProductImageCategory_Material); ViewBag.DsDesignImage = DsDesignImage; ViewBag.DsMaterialImage = DsMaterialImage; #endregion return(View(product)); } else { return(View(new shProduct())); } } if (TempData["ERROR"] != null) { ModelState.AddModelError("", TempData["ERROR"].ToString()); shCategoryService _category = new shCategoryService(); if (TempData["CategoryGuid"] != null) { ViewBag.citySel = _category.CategoryName(TempData["CategoryGuid"].ToString()); } ViewBag.CategoryGuid = TempData["CategoryGuid"]; ViewBag.ProductGuid = TempData["ProductGuid"]; ViewBag.ProductName = TempData["ProductName"]; ViewBag.Description = TempData["Description"]; ViewBag.Details = TempData["Details"]; TempData["ERROR"] = null; } return(View(new shProduct())); }
public static MvcHtmlString CategoryName(this HtmlHelper helper, string CategoryGuid) { shCategoryService _category = new shCategoryService(); return(new MvcHtmlString(_category.CategoryName(CategoryGuid))); }