Пример #1
0
        public ViewResult showorder()
        {
            var context = new LntDatabaseEntitiesEntities();
            var model   = context.orders.ToList();

            return(View(model));
        }
Пример #2
0
        public ActionResult Neworders(order ord)
        {
            var context = new LntDatabaseEntitiesEntities();

            context.orders.Add(ord);
            context.SaveChanges();
            return(RedirectToAction("showorder"));
        }
Пример #3
0
        public ViewResult Find(string id)
        {
            int custid  = int.Parse(id);
            var context = new LntDatabaseEntitiesEntities();
            var model   = context.orders.FirstOrDefault((e) => e.cust_id == custid);

            return(View(model));
        }
Пример #4
0
        public ActionResult Delete(string id)
        {
            //convert string to int
            int custid  = int.Parse(id);
            var context = new LntDatabaseEntitiesEntities();
            var model   = context.orders.FirstOrDefault((e) => e.cust_id == custid);

            context.orders.Remove(model);
            context.SaveChanges();
            return(RedirectToAction("showorder"));
        }
Пример #5
0
        public ActionResult Find(order ord)
        {
            var context = new LntDatabaseEntitiesEntities();
            var model   = context.orders.FirstOrDefault((e) => e.cust_id == ord.cust_id);

            model.cust_name = ord.cust_name;
            model.item_name = ord.item_name;
            model.price     = ord.price;
            context.SaveChanges();//Commits the changes made to the records...
            return(RedirectToAction("showorder"));
        }