예제 #1
0
 public void Put(Guid id, ManufacturerInfo model)
 {
     using (DatabaseContext context = Util.CreateContext())
     {
         //delete and readd
         var manufacturer = (from m in context.Manufacturers
                             where m.Guid == id
                             select m).First();
         manufacturer.NameTranslations = JsonConvert.SerializeObject(model.NameTranslations);
         context.SaveChanges();
     }
 }
예제 #2
0
        public void Post(ManufacturerInfo model)
        {
            //new, save to database
            Guid guid     = Guid.NewGuid();
            Guid nameGuid = Guid.NewGuid();

            Manufacturer newManufacturer = new Manufacturer
            {
                Guid             = guid,
                NameTranslations = JsonConvert.SerializeObject(model.NameTranslations)
            };

            using (DatabaseContext context = Util.CreateContext())
            {
                context.Manufacturers.Add(newManufacturer);
                context.SaveChanges();
            }
        }