Beispiel #1
0
        public string Form(string Name, string Tel, int Car)
        {
            Order order = new Order
            {
                UserName = Name,
                UserTel  = Tel,
                CarId    = Car,
                Status   = "Создана"
            };

            db.Orders.Add(order);
            db.SaveChanges();
            return("Ваша заявка на автомобиль" + db.Cars.FirstOrDefault(x => x.Id == Car).Title + " ,была принята");
        }
Beispiel #2
0
 public ActionResult Edit(Models.User postback)
 {
     using (Models.Database1Entities1 db = new Models.Database1Entities1())
     {
         var result = (from s in db.User
                       where s.Uid == postback.Uid
                       select s).FirstOrDefault();
         if (result != default(Models.User))
         {
             result.Uname   = postback.Uname;
             result.Phone   = postback.Phone;
             result.Address = postback.Address;
             db.SaveChanges();
             //設定成功訊息
             TempData["ResultMessage"] = String.Format("使用者[{0}]成功編輯", postback.Uname);
             return(RedirectToAction("Details", "Tables"));
         }
     }
     //設定錯誤訊息
     TempData["ResultMessage"] = String.Format("使用者[{0}]不存在,請重新操作", postback.Uname);
     return(RedirectToAction("Edit", "Tables"));
 }