コード例 #1
0
 public IActionResult UpdateDeliveryman(Deliveryman deliveryman)
 {
     if (_context.Deliveryman.FirstOrDefault(d => d.IdDeliveryman == deliveryman.IdDeliveryman) == null)
     {
         return(NotFound());
     }
     _context.Deliveryman.Attach(deliveryman);
     _context.Entry(deliveryman).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
     _context.SaveChanges();
     return(Ok(deliveryman));
 }
コード例 #2
0
 public IActionResult UpdateMeal(Meal meal)
 {
     if (_context.Meal.FirstOrDefault(m => m.IdMeal == m.IdMeal) == null)
     {
         return(NotFound());
     }
     _context.Meal.Attach(meal);
     _context.Entry(meal).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
     _context.SaveChanges();
     return(Ok(meal));
 }
コード例 #3
0
 public IActionResult UpdateUser(User user)
 {
     if (_context.User.FirstOrDefault(u => u.IdUser == user.IdUser) == null)
     {
         return(NotFound());
     }
     _context.User.Attach(user);
     _context.Entry(user).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
     _context.SaveChanges();
     return(Ok(user));
 }