Exemple #1
0
        public string UpdateOrder(string takeoutorderid)
        {
            var          takeoutorder = TakeOutDb.TakeOutOrders.FirstOrDefault(t => t.TakeOutOrderID == Convert.ToInt32(takeoutorderid));
            TakeOutOrder t            = new TakeOutOrder();

            t.TakeOutOrderID         = takeoutorder.TakeOutOrderID;
            t.StudentID              = takeoutorder.StudentID;
            t.Name                   = takeoutorder.Name;
            t.PhoneNumber            = takeoutorder.PhoneNumber;
            t.State                  = "已取";
            TakeOutDb.Entry(t).State = EntityState.Modified;
            TakeOutDb.SaveChanges();
            return("OK");
        }
Exemple #2
0
        public string AddOrder(string phonenumber, string takeoutorderid)
        {
            var student = TakeOutDb.Students.FirstOrDefault(t => t.PhoneNumber == Convert.ToInt32(phonenumber));

            if (student != null)
            {
                TakeOutOrder t = new TakeOutOrder();
                t.StudentID      = student.StudentID;
                t.Name           = student.Name;
                t.PhoneNumber    = student.PhoneNumber;
                t.TakeOutOrderID = Convert.ToInt32(takeoutorderid);
                t.State          = "已达";
                TakeOutDb.TakeOutOrders.Add(t);
                TakeOutDb.SaveChanges();
                return("OK");
            }
            else
            {
                return("False");
            }
        } //录入外卖订单信息