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(); }
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(); }