예제 #1
0
 public RoomRental Add(RoomRental item)
 {
     var newRoomRental = (RoomRental)item.Clone();
     newRoomRental.Id = !_roomRentals.Any() ? 1 : _roomRentals.Max(car => car.Id) + 1;
     _roomRentals.Add(newRoomRental);
     return (RoomRental)newRoomRental.Clone();
 }
예제 #2
0
 public RoomRental Update(RoomRental item)
 {
     var existRoomRental = _roomRentals.SingleOrDefault(roomRental => roomRental.Id == item.Id);
     if (existRoomRental == null)
     {
         throw new NullReferenceException();
     }
     existRoomRental.Address = item.Address;
     return (RoomRental)existRoomRental.Clone();
 }