public async Task <ActionResult <SettlementPeriod> > PostSettlementPeriod(SettlementPeriod settlementPeriod) { _context.SettlementPeriods.Add(settlementPeriod); await _context.SaveChangesAsync(); return(CreatedAtAction("GetSettlementPeriod", new { id = settlementPeriod.Id }, settlementPeriod)); }
public async Task <IActionResult> PutSettlementPeriod(int id, SettlementPeriod settlementPeriod) { if (id != settlementPeriod.Id) { return(BadRequest()); } _context.Entry(settlementPeriod).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SettlementPeriodExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
/// <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 :) hashCode = hashCode * 59 + QuoteCurrency.GetHashCode(); hashCode = hashCode * 59 + Kind.GetHashCode(); if (TickSize != null) { hashCode = hashCode * 59 + TickSize.GetHashCode(); } if (ContractSize != null) { hashCode = hashCode * 59 + ContractSize.GetHashCode(); } if (IsActive != null) { hashCode = hashCode * 59 + IsActive.GetHashCode(); } hashCode = hashCode * 59 + OptionType.GetHashCode(); if (MinTradeAmount != null) { hashCode = hashCode * 59 + MinTradeAmount.GetHashCode(); } if (InstrumentName != null) { hashCode = hashCode * 59 + InstrumentName.GetHashCode(); } hashCode = hashCode * 59 + SettlementPeriod.GetHashCode(); if (Strike != null) { hashCode = hashCode * 59 + Strike.GetHashCode(); } hashCode = hashCode * 59 + BaseCurrency.GetHashCode(); if (CreationTimestamp != null) { hashCode = hashCode * 59 + CreationTimestamp.GetHashCode(); } if (ExpirationTimestamp != null) { hashCode = hashCode * 59 + ExpirationTimestamp.GetHashCode(); } return(hashCode); } }
/// <summary> /// Returns true if Instrument instances are equal /// </summary> /// <param name="other">Instance of Instrument to be compared</param> /// <returns>Boolean</returns> public bool Equals(Instrument other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( QuoteCurrency == other.QuoteCurrency || QuoteCurrency.Equals(other.QuoteCurrency) ) && ( Kind == other.Kind || Kind.Equals(other.Kind) ) && ( TickSize == other.TickSize || TickSize != null && TickSize.Equals(other.TickSize) ) && ( ContractSize == other.ContractSize || ContractSize != null && ContractSize.Equals(other.ContractSize) ) && ( IsActive == other.IsActive || IsActive != null && IsActive.Equals(other.IsActive) ) && ( OptionType == other.OptionType || OptionType.Equals(other.OptionType) ) && ( MinTradeAmount == other.MinTradeAmount || MinTradeAmount != null && MinTradeAmount.Equals(other.MinTradeAmount) ) && ( InstrumentName == other.InstrumentName || InstrumentName != null && InstrumentName.Equals(other.InstrumentName) ) && ( SettlementPeriod == other.SettlementPeriod || SettlementPeriod.Equals(other.SettlementPeriod) ) && ( Strike == other.Strike || Strike != null && Strike.Equals(other.Strike) ) && ( BaseCurrency == other.BaseCurrency || BaseCurrency.Equals(other.BaseCurrency) ) && ( CreationTimestamp == other.CreationTimestamp || CreationTimestamp != null && CreationTimestamp.Equals(other.CreationTimestamp) ) && ( ExpirationTimestamp == other.ExpirationTimestamp || ExpirationTimestamp != null && ExpirationTimestamp.Equals(other.ExpirationTimestamp) )); }