public DeliveryAddress(TicketGames.API.Models.Participant.Participant participant) { this.Name = participant.Name; this.Street = participant.Street; this.Number = participant.Number; this.Complement = participant.Complement; this.District = participant.District; this.City = participant.City; this.State = participant.State; this.ZipCode = participant.ZipCode; this.Email = participant.Email; this.HomePhone = participant.HomePhone; this.CellPhone = participant.CellPhone; }
public IHttpActionResult CreateOrderDeliveryAddress(long cartId) { try { OrderDeliveryAddress orderDeliveryAddress = null; DeliveryAddress deliveryAddress = null; ClaimsPrincipal principal = Request.GetRequestContext().Principal as ClaimsPrincipal; long.TryParse(principal.Claims.Where(c => c.Type == "participant_Id").Single().Value, out this.participantId); var deliveryAddressResult = this._cartService.Get(this.participantId, cartId); if (deliveryAddressResult != null && deliveryAddressResult.Id > 0) { deliveryAddress = new DeliveryAddress(deliveryAddressResult); } else { TicketGames.API.Models.Participant.Participant participant = null; var key = string.Concat("Participant:Id:", participantId.ToString(), ":Register"); participant = CacheManager.GetObject <TicketGames.API.Models.Participant.Participant>(key); if (participant == null) { var result = this._participantService.GetParticipant(participantId); participant = new TicketGames.API.Models.Participant.Participant(result); } deliveryAddress = new DeliveryAddress(participant); } return(Ok(deliveryAddress)); } catch (Exception ex) { return(NotFound()); } }