Exemplo n.º 1
0
        public JsonResult EditProccess(ProductCatCRUD model)
        {
            rs r;

            try
            {
                var entity = __db.ProductCat.Find(model.Id);
                entity.Name = model.Name;
                //entity.ParentId = (model.ParentId==-1)?null:model.ParentId;
                entity.Description = model.Description;
                entity.QuanId      = model.QuanId;

                if (string.IsNullOrWhiteSpace(model.ImageThumbnail))
                {
                    entity.ImageThumbnail = "/Content/images/sample/menu1.png";
                }
                else
                {
                    entity.ImageThumbnail = model.ImageThumbnail;
                }
                __db.SaveChanges();
                r = rs.T("Ok");
            }
            catch (Exception ex)
            {
                r = rs.F(ex.Message);
            }
            return(Json(r, JsonRequestBehavior.DenyGet));
        }
        public ActionResult Create()
        {
            ProductCatCRUD vm = new ProductCatCRUD();

            vm.ParentId = -1;
            return(View(vm));
        }
Exemplo n.º 3
0
        public ActionResult Create()
        {
            var            __auth = MySsAuthUsers.GetAuth();
            ProductCatCRUD vm     = new ProductCatCRUD();

            vm.ddlQuan = __db.Quan.Where(w => w.UserId == __auth.ID).ToList().Select(s => new SelectListItem()
            {
                Text  = "[" + s.MaQuan + "] " + s.TenQuan,
                Value = s.Id.ToString()
            });
            //vm.ParentId = -1;
            return(View(vm));
        }
        public ActionResult Edit(int id)
        {
            var            entity = __db.ProductCat.Find(id);
            ProductCatCRUD vm     = new ProductCatCRUD();

            vm.Id            = entity.Id;
            vm.Name          = entity.Name;
            vm.ParentId      = entity.ParentId;
            vm.ShowInProduct = entity.ShowInProduct;
            vm.Description   = entity.Description;

            return(View(vm));
        }
Exemplo n.º 5
0
        public ActionResult Edit(int id)
        {
            var            __auth = MySsAuthUsers.GetAuth();
            var            entity = __db.ProductCat.Find(id);
            ProductCatCRUD vm     = new ProductCatCRUD();

            vm.Id   = entity.Id;
            vm.Name = entity.Name;
            //vm.ParentId = entity.ParentId;
            vm.Description    = entity.Description;
            vm.ImageThumbnail = entity.ImageThumbnail;
            vm.QuanId         = entity.QuanId;
            vm.ddlQuan        = __db.Quan.Where(w => w.UserId == __auth.ID).ToList().Select(s => new SelectListItem()
            {
                Text  = "[" + s.MaQuan + "] " + s.TenQuan,
                Value = s.Id.ToString()
            });
            return(View(vm));
        }
        public JsonResult EditProccess(ProductCatCRUD model)
        {
            rs r;

            try
            {
                var entity = __db.ProductCat.Find(model.Id);
                entity.Name          = model.Name;
                entity.ShowInProduct = model.ShowInProduct;
                entity.ParentId      = (model.ParentId == -1)?null:model.ParentId;
                entity.Description   = model.Description;
                __db.SaveChanges();
                r = rs.T("Ok");
            }
            catch (Exception ex)
            {
                r = rs.F(ex.Message);
            }
            return(Json(r, JsonRequestBehavior.DenyGet));
        }