public ActionResult Create(string DanhMucGuid, int?DanhMucId, string CategoryName, string CategoryGuid, bool?Status, string Description, int?SortOrder, string FileName) { shCategory category = new shCategory(); using (var context = new ShopOnlineDb()) { using (var dbContextTransaction = context.Database.BeginTransaction()) { try { // Insert- update Category shCategoryService _category = new shCategoryService(); category = _category.ThemMoi_HieuChinhCategory( DanhMucGuid, null, CategoryName, CategoryGuid, null, Status, DateTime.Now, null, Description, SortOrder, FileName); // Insesrt Image if (!string.IsNullOrEmpty(FileName) || !string.IsNullOrWhiteSpace(FileName)) { shCategoryImageService _categoryImage = new shCategoryImageService(); shCategoryImage categoryImage = _categoryImage.Insert_UpdateCategoryImage( null, null, category.CategoryGuid, FileName, null, User.Identity.GetUserLogin().Userid, true, DateTime.Now, null ); } dbContextTransaction.Commit(); } catch (Exception ex) { dbContextTransaction.Rollback(); } } } int?page = CommonHelper.FindPageCategory(category.CategoryGuid, category.CategoryId); return(RedirectToAction("Index", new { page = page })); }
public ActionResult DialogHighLight(string CategoryGuid, string ImageIcon, string ImageIconActive) { // 1. Upload file sản phẩm nổi bật shCategoryImageService _categoryImage = new shCategoryImageService(); shCategoryImage categoryImage = new shCategoryImage(); _categoryImage.Insert_UpdateCategoryImage( null, null, CategoryGuid, ImageIcon, null, User.Identity.GetUserLogin().Userid, true, DateTime.Now, Config.Category_Image_Icon ); _categoryImage.Insert_UpdateCategoryImage( null, null, CategoryGuid, ImageIconActive, null, User.Identity.GetUserLogin().Userid, true, DateTime.Now, Config.Category_Image_Icon_Active ); if (Request.IsAjaxRequest()) { return(Json("OK", JsonRequestBehavior.AllowGet)); } return(RedirectToAction("Index")); }
public ActionResult Create(string DanhMucGuid, int?DanhMucId, string CategoryName, string CategoryGuid, bool?Status, string Description, int?SortOrder, string FileName) { // Insert Category shCategoryService _category = new shCategoryService(); shCategory category = _category.ThemMoi_HieuChinhCategory( DanhMucGuid, null, CategoryName, CategoryGuid, HttpContext.User.Identity.GetUserLogin().Userid, Status, DateTime.Now, null, Description, SortOrder, FileName); // Insesrt Image if (!string.IsNullOrEmpty(FileName) || !string.IsNullOrWhiteSpace(FileName)) { shCategoryImageService _categoryImage = new shCategoryImageService(); shCategoryImage categoryImage = _categoryImage.Insert_UpdateCategoryImage( null, null, category.CategoryGuid, FileName, null, User.Identity.GetUserLogin().Userid, true, DateTime.Now, null ); } int?page = CommonHelper.FindPageCategory(category.CategoryGuid, category.CategoryId); return(RedirectToAction("Index", new { page = page })); }