Пример #1
0
        public ActionResult Create(Dinner dinner)
        {
            if (ModelState.IsValid)
            {
                dbContext.Dinners.Add(dinner);
                dbContext.SaveChanges();

                return RedirectToAction("Index");
            }

            return View(dinner);
        }
Пример #2
0
 public static void AddNewDinner()
 {
     NerdDinners db = new NerdDinners();
     var dinner = new Dinner()
     {
         Title = "xinkai's party",
         EventDate = DateTime.Parse("12/31/2013"),
         Address = "Building 40",
         HostedBy = "*****@*****.**",
     };
     db.Dinners.Add(dinner);
     db.SaveChanges();
 }