Exemple #1
0
        public void Put(Guid id, SkuInfo model)
        {
            using (DatabaseContext context = Util.CreateContext())
            {
                //delete and readd
                Sku item = (from i in context.Skus
                            where i.Guid == id
                            select i).FirstOrDefault();

                item.NameTranslations = JsonConvert.SerializeObject(model.NameTranslations);
                context.SaveChanges();
            }
        }
Exemple #2
0
        public void Post(SkuInfo model)
        {
            Sku newSku = new Sku
            {
                Guid             = Guid.NewGuid(),
                NameTranslations = JsonConvert.SerializeObject(model.NameTranslations),
                ProductGuid      = model.ProductGuid
            };

            using (DatabaseContext context = Util.CreateContext())
            {
                context.Skus.Add(newSku);
                context.SaveChanges();
            }
        }