예제 #1
0
        public bool Update(Booking booking)
        {
            bool shouldUpdate = false;

            if (!Notes.Equals(booking.Notes, StringComparison.OrdinalIgnoreCase))
            {
                Notes        = booking.Notes;
                shouldUpdate = true;
            }

            if (!BookingDate.Equals(booking.BookingDate))
            {
                BookingDate  = booking.BookingDate;
                shouldUpdate = true;
            }

            if (!ClientId.Equals(booking.ClientId))
            {
                ClientId     = booking.ClientId;
                shouldUpdate = true;
            }

            if (!VehicleId.Equals(booking.ClientId))
            {
                VehicleId    = booking.VehicleId;
                shouldUpdate = true;
            }

            return(shouldUpdate);
        }
예제 #2
0
        /// <summary>
        /// Returns true if Booking instances are equal
        /// </summary>
        /// <param name="other">Instance of Booking to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Booking other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     ShipId == other.ShipId ||
                     ShipId != null &&
                     ShipId.Equals(other.ShipId)
                 ) &&
                 (
                     BookingDate == other.BookingDate ||
                     BookingDate != null &&
                     BookingDate.Equals(other.BookingDate)
                 ) &&
                 (
                     Price == other.Price ||
                     Price != null &&
                     Price.Equals(other.Price)
                 ));
        }