/// <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 (AmountPaid != null) { hashCode = hashCode * 59 + AmountPaid.GetHashCode(); } if (CardPaymentMethodSpecificOutput != null) { hashCode = hashCode * 59 + CardPaymentMethodSpecificOutput.GetHashCode(); } if (MobilePaymentMethodSpecificOutput != null) { hashCode = hashCode * 59 + MobilePaymentMethodSpecificOutput.GetHashCode(); } if (PaymentMethod != null) { hashCode = hashCode * 59 + PaymentMethod.GetHashCode(); } if (RedirectPaymentMethodSpecificOutput != null) { hashCode = hashCode * 59 + RedirectPaymentMethodSpecificOutput.GetHashCode(); } return(hashCode); } }
public IHttpActionResult PutAmountPaid(int id, AmountPaid amountPaid) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != amountPaid.id) { return(BadRequest()); } db.Entry(amountPaid).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!AmountPaidExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public decimal GetPaidBy(Person person) { decimal paid = 0; AmountPaid.TryGetValue(person.Id, out paid); return(paid); }
public IHttpActionResult GetAmountPaid(int id) { AmountPaid amountPaid = db.amountsPaid.Find(id); if (amountPaid == null) { return(NotFound()); } return(Ok(amountPaid)); }
public void AddPaidBy(Person otherParty, decimal amount) { if (otherParty.Id == this.Id) { } else if (AmountPaid.ContainsKey(otherParty.Id)) { AmountPaid[otherParty.Id] += amount; } else { AmountPaid.Add(otherParty.Id, amount); } }
/// <summary> /// Returns true if PaymentOutput instances are equal /// </summary> /// <param name="other">Instance of PaymentOutput to be compared</param> /// <returns>Boolean</returns> public bool Equals(PaymentOutput other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( AmountPaid == other.AmountPaid || AmountPaid != null && AmountPaid.Equals(other.AmountPaid) ) && ( CardPaymentMethodSpecificOutput == other.CardPaymentMethodSpecificOutput || CardPaymentMethodSpecificOutput != null && CardPaymentMethodSpecificOutput.Equals(other.CardPaymentMethodSpecificOutput) ) && ( MobilePaymentMethodSpecificOutput == other.MobilePaymentMethodSpecificOutput || MobilePaymentMethodSpecificOutput != null && MobilePaymentMethodSpecificOutput.Equals(other.MobilePaymentMethodSpecificOutput) ) && ( PaymentMethod == other.PaymentMethod || PaymentMethod != null && PaymentMethod.Equals(other.PaymentMethod) ) && ( RedirectPaymentMethodSpecificOutput == other.RedirectPaymentMethodSpecificOutput || RedirectPaymentMethodSpecificOutput != null && RedirectPaymentMethodSpecificOutput.Equals(other.RedirectPaymentMethodSpecificOutput) )); }