Ejemplo n.º 1
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (Activity != null)
         {
             hashCode = hashCode * 59 + Activity.GetHashCode();
         }
         if (Athlete != null)
         {
             hashCode = hashCode * 59 + Athlete.GetHashCode();
         }
         if (AverageCadence != null)
         {
             hashCode = hashCode * 59 + AverageCadence.GetHashCode();
         }
         if (AverageSpeed != null)
         {
             hashCode = hashCode * 59 + AverageSpeed.GetHashCode();
         }
         if (Distance != null)
         {
             hashCode = hashCode * 59 + Distance.GetHashCode();
         }
         if (ElapsedTime != null)
         {
             hashCode = hashCode * 59 + ElapsedTime.GetHashCode();
         }
         if (StartIndex != null)
         {
             hashCode = hashCode * 59 + StartIndex.GetHashCode();
         }
         if (EndIndex != null)
         {
             hashCode = hashCode * 59 + EndIndex.GetHashCode();
         }
         if (LapIndex != null)
         {
             hashCode = hashCode * 59 + LapIndex.GetHashCode();
         }
         if (MaxSpeed != null)
         {
             hashCode = hashCode * 59 + MaxSpeed.GetHashCode();
         }
         if (MovingTime != null)
         {
             hashCode = hashCode * 59 + MovingTime.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (PaceZone != null)
         {
             hashCode = hashCode * 59 + PaceZone.GetHashCode();
         }
         if (Split != null)
         {
             hashCode = hashCode * 59 + Split.GetHashCode();
         }
         if (StartDate != null)
         {
             hashCode = hashCode * 59 + StartDate.GetHashCode();
         }
         if (StartDateLocal != null)
         {
             hashCode = hashCode * 59 + StartDateLocal.GetHashCode();
         }
         if (TotalElevationGain != null)
         {
             hashCode = hashCode * 59 + TotalElevationGain.GetHashCode();
         }
         return(hashCode);
     }
 }
 public IActionResult DropLap(LapIndex lap)
 {
     timerManager.DropLap(lap.Index);
     return(Ok());
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Returns true if Lap instances are equal
        /// </summary>
        /// <param name="other">Instance of Lap to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Lap other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     Activity == other.Activity ||
                     Activity != null &&
                     Activity.Equals(other.Activity)
                 ) &&
                 (
                     Athlete == other.Athlete ||
                     Athlete != null &&
                     Athlete.Equals(other.Athlete)
                 ) &&
                 (
                     AverageCadence == other.AverageCadence ||
                     AverageCadence != null &&
                     AverageCadence.Equals(other.AverageCadence)
                 ) &&
                 (
                     AverageSpeed == other.AverageSpeed ||
                     AverageSpeed != null &&
                     AverageSpeed.Equals(other.AverageSpeed)
                 ) &&
                 (
                     Distance == other.Distance ||
                     Distance != null &&
                     Distance.Equals(other.Distance)
                 ) &&
                 (
                     ElapsedTime == other.ElapsedTime ||
                     ElapsedTime != null &&
                     ElapsedTime.Equals(other.ElapsedTime)
                 ) &&
                 (
                     StartIndex == other.StartIndex ||
                     StartIndex != null &&
                     StartIndex.Equals(other.StartIndex)
                 ) &&
                 (
                     EndIndex == other.EndIndex ||
                     EndIndex != null &&
                     EndIndex.Equals(other.EndIndex)
                 ) &&
                 (
                     LapIndex == other.LapIndex ||
                     LapIndex != null &&
                     LapIndex.Equals(other.LapIndex)
                 ) &&
                 (
                     MaxSpeed == other.MaxSpeed ||
                     MaxSpeed != null &&
                     MaxSpeed.Equals(other.MaxSpeed)
                 ) &&
                 (
                     MovingTime == other.MovingTime ||
                     MovingTime != null &&
                     MovingTime.Equals(other.MovingTime)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     PaceZone == other.PaceZone ||
                     PaceZone != null &&
                     PaceZone.Equals(other.PaceZone)
                 ) &&
                 (
                     Split == other.Split ||
                     Split != null &&
                     Split.Equals(other.Split)
                 ) &&
                 (
                     StartDate == other.StartDate ||
                     StartDate != null &&
                     StartDate.Equals(other.StartDate)
                 ) &&
                 (
                     StartDateLocal == other.StartDateLocal ||
                     StartDateLocal != null &&
                     StartDateLocal.Equals(other.StartDateLocal)
                 ) &&
                 (
                     TotalElevationGain == other.TotalElevationGain ||
                     TotalElevationGain != null &&
                     TotalElevationGain.Equals(other.TotalElevationGain)
                 ));
        }