public int Update(RestaurantAdmin restaurantAdmin) { RestaurantAdmin restaurantAdminToUpdate = _context.RestaurantAdmins.SingleOrDefault(e => e.UserId == restaurantAdmin.UserId); foreach (PropertyInfo property in typeof(RestaurantAdmin).GetProperties()) { property.SetValue(restaurantAdminToUpdate, property.GetValue(restaurantAdmin, null), null); } return(_context.SaveChanges()); }
public int Delete(int id) { RestaurantAdmin restaurantAdminToDelete = _context.RestaurantAdmins.SingleOrDefault(e => e.UserId == id); if (restaurantAdminToDelete != null) { _context.RestaurantAdmins.Remove(restaurantAdminToDelete); } return(_context.SaveChanges()); }
public int Insert(RestaurantAdmin restaurantAdmin) { _context.RestaurantAdmins.Add(restaurantAdmin); return(_context.SaveChanges()); }