Ejemplo n.º 1
0
        public ActionResult Create([Bind(Include = "Id,FirstName,LastName,Birthday,RegisterTime")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                db.Employees.Add(employee);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(employee));
        }
Ejemplo n.º 2
0
        public ActionResult Create([Bind(Include = "Id,EmployeeId,CreateTime,ProcessTime")] Order order)
        {
            if (ModelState.IsValid)
            {
                db.Orders.Add(order);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.EmployeeId = new SelectList(db.Employees, "Id", "FirstName", order.EmployeeId);
            return(View(order));
        }
Ejemplo n.º 3
0
        public ActionResult Create([Bind(Include = "Id,Name,Price,Description,EmployeeId,MCreateTime")] Menu menu)
        {
            if (ModelState.IsValid)
            {
                db.Menus.Add(menu);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.EmployeeId = new SelectList(db.Employees, "Id", "FirstName", menu.EmployeeId);
            return(View(menu));
        }
Ejemplo n.º 4
0
        public ActionResult Create([Bind(Include = "Id,MenuId,OrderId,GenerateTime,Number")] Order_Detail order_Detail)
        {
            if (ModelState.IsValid)
            {
                db.Order_Detail.Add(order_Detail);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.MenuId  = new SelectList(db.Menus, "Id", "Name", order_Detail.MenuId);
            ViewBag.OrderId = new SelectList(db.Orders, "Id", "Id", order_Detail.OrderId);
            return(View(order_Detail));
        }