예제 #1
0
        public ActionResult ChuyenNhanVienTheoDoi(string CategoryGuid, int?UserId, string MoTaNoiDungChuyen)
        {
            shCategoryService _category = new shCategoryService();
            shCategory        category  = _category.FindByKey(CategoryGuid);

            _category.ThemMoi_HieuChinhCategory(
                category.CategoryGuid,
                null,
                category.CategoryName,
                category.ParentId,
                UserId,
                category.Status,
                category.CreatedDate,
                category.MetaTitle,
                category.Description,
                category.SortOrder,
                category.FileName);


            if (Request.IsAjaxRequest())
            {
                return(Json("OK", JsonRequestBehavior.AllowGet));
            }

            return(RedirectToAction("Index"));
        }
예제 #2
0
        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 }));
        }
예제 #3
0
        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 }));
        }