Beispiel #1
0
 public Sku()
 {
     brand=new Brand();
     smalPhoto=new Photo();
     listPhoto=new List<PhotoBig>();
     listCategory=new List<Category>();
     listSpecification=new List<Specification>();
     listComment = new List<Comment>();
 }
Beispiel #2
0
        public bool AddOrUpdateBrand(Brand brand)
        {
            bool result = false;
            try
            {
                dbService.Run(db =>
                {
                    var brandDB= db.GetRepository<Brand>().TryOne(brand.id);
                    if (brandDB==null)
                    {
                        db.GetRepository<Brand>().Add(brand);
                    }
                    else
                    {
                        brandDB.name = brand.name;
                        db.GetRepository<Brand>().Update(brandDB);
                    }

                });
                result = true;
            }
            catch (Exception err)
            {
                result = false;
                logger.Error(err.Message);
            }
            return result;
        }