Example #1
0
        public ActionResult AddNewCoffee(Item NewItem)
        {
            GrandCircusDBEntities CoffeeDB = new GrandCircusDBEntities(); //orm

            CoffeeDB.Items.Add(NewItem);                                  // saves the new employee to the list
            CoffeeDB.SaveChanges();                                       // saves the new employee to the database
            return(RedirectToAction("About"));
        }
Example #2
0
        public ActionResult DeleteCoffee(string name)
        {
            GrandCircusDBEntities CoffeeDB = new GrandCircusDBEntities();
            Item i = CoffeeDB.Items.Find(name);

            CoffeeDB.Items.Remove(i);          // removes employee from the list
            CoffeeDB.SaveChanges();            // reflects the changes we did on list we have to the db
            return(RedirectToAction("About")); // go and execute action once you are done
        }