コード例 #1
0
 public ActionResult Edit(Dish dish)
 {
     if (ModelState.IsValid)
     {
         db.Entry(dish).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(dish));
 }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "Id,Name")] DishCategory dishCategory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(dishCategory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(dishCategory));
 }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "Id,DateTime,Summ,NumberOfSpentBonuses,Total")] Order order)
 {
     if (ModelState.IsValid)
     {
         db.Entry(order).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(order));
 }
コード例 #4
0
 public ActionResult Edit([Bind(Include = "Id,Name,Surname,Patronymic,PhoneNumber,Password,Email,DiscountInPercent,TotalSpentMoney")] User user)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(user));
 }
コード例 #5
0
        public void Update(T entity)
        {
            _context.Entry(entity).State = EntityState.Modified;

            Save();
        }