Пример #1
0
 public ActionResult New(Studio studio)
 {
     try
     {
         ds.Studios.Add(studio);
         ds.SaveChanges();
         return(RedirectToAction("Index"));
     }
     catch (Exception e)
     {
         return(View());
     }
 }
Пример #2
0
        public static void AddBook()
        {
            var book = new Book <Spices>
            {
                Spice = new Spices()
                {
                    SpiceMixName = "Zuppa di ceci",
                    Supplier     = "Boh"
                }
            };

            var context = new StudioDBContext();

            context.Books.Add(book);
            context.SaveChanges();
        }