コード例 #1
0
        public bool UpdateProduct(ZZTemplate item)
        {
            var result = true;

            using (var uow = GetUnitOfWork())
            {
                var t = uow.Repository <ZZ_Template>().Find(item.TemplateId);
                if (t != null)
                {
                    t.Category  = item.Category;
                    t.Sex       = item.Sex;
                    t.Color     = item.Color;
                    t.ColorCode = item.ColorCode;
                    t.FrontImg  = item.FrontImg;
                    t.BackImg   = item.BackImg;
                    uow.Repository <ZZ_Template>().Update(t);
                    uow.Save();
                }
                else
                {
                    return(false);
                }
            }

            return(result);
        }
コード例 #2
0
        public ActionResult UpdateProduct(ZZTemplate item)
        {
            HandleImg(item);
            var r = BS.UpdateProduct(item);

            return(new JsonResult()
            {
                Data = r
            });
        }
コード例 #3
0
        public bool AddProduct(ZZTemplate item)
        {
            var r = true;

            using (var uow = GetUnitOfWork())
            {
                var t = new ZZ_Template();
                t.TemplateId = Guid.NewGuid();
                t.Category   = item.Category;
                t.Sex        = item.Sex;
                t.Color      = item.Color;
                t.ColorCode  = item.ColorCode;
                t.FrontImg   = item.FrontImg;
                t.BackImg    = item.BackImg;

                uow.Repository <ZZ_Template>().Insert(t);
                uow.Save();
            }
            return(r);
        }
コード例 #4
0
 private void HandleImg(ZZTemplate t)
 {
     t.FrontImg = CheckImg(t.FrontImg);
     t.BackImg  = CheckImg(t.BackImg);
 }