private static Dictionary <long, int> _toDictionary(Transport.QuantityList qList) { var res = new Dictionary <long, int>(); foreach (var q in qList) { res[q.ItemId.Value] = q.Quantity.Value; } return(res); }
/// <summary> /// Returns true if QuantityList instances are equal /// </summary> /// <param name="other">Instance of QuantityList to be compared</param> /// <returns>Boolean</returns> public bool Equals(QuantityList other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(false); }
public override async Task <IActionResult> PatchAsync([FromRoute] long?orderId, [FromBody] Transport.QuantityList quantityList) { if (!orderId.HasValue) { return(BadRequest()); } try { var orderTransport = new Transport.Order() { OrderId = orderId.Value, Items = quantityList }; var orderBusiness = Mapping.Instance.Map <Business.Order>(orderTransport); var order = await _orderRepository.UpdateOrder(orderBusiness); return(Json(Mapping.Instance.Map <Transport.Order>(order))); } catch (OrderNotFoundException) { return(NotFound()); } }
} // RestClient support /// <summary> /// Initializes a new instance of the <see cref="Order" /> class. /// </summary> /// <param name="OrderId">OrderId.</param> /// <param name="Items">Items.</param> public Order(long?OrderId = null, QuantityList Items = null) { this.OrderId = OrderId; this.Items = Items; }
public abstract Task <IActionResult> PatchAsync([FromRoute] long?orderId, [FromBody] Transport.QuantityList quantityList);