public ApiResult<CustomerTicket> SaveQuick(string customerId, CustomerTicket ticket, CustomerPayment payment, Event eventTicket) { try { var customer = this.customerService.GetCustomerById(Guid.Parse(customerId)); ticket.Event = eventTicket; var result = this.customerService.CreateQuickTicket(ticket, payment, customer); return new ApiResult<CustomerTicket>() { Result = result, Data = ticket, }; } catch (System.Exception ex) { return new ApiResult<CustomerTicket>() { Result = false, Data = null, ErrorMessage = ex.Message }; } }
public ActionResult SaveQuick(TicketModelView model) { try { var ticket = new CustomerTicket() { Quantity = model.Quantity, DtEvent = model.DtEvent, }; var currentUser = Membership.GetUser(); var eventModel = this.eventService.GetById(model.EventId); var customer = this.customerService.GetCustomerById((Guid)currentUser.ProviderUserKey); var customerPayment = new CustomerPayment() { InstantBuy = Guid.Parse(model.PaymentToken), SecurityCode = model.SecurityCode }; ticket.Event = eventModel; this.customerService.CreateQuickTicket(ticket, customerPayment, customer); return JsonSuccess(); } catch (System.Exception ex) { return JsonError(ex.Message); } }
public ActionResult Save(TicketModelView model) { try { var ticket = Mapper.Map<TicketModelView, CustomerTicket>(model); var currentUser = Membership.GetUser(); var eventModel = this.eventService.GetById(model.EventId); var customer = this.customerService.GetCustomerById((Guid)currentUser.ProviderUserKey); var customerPayment = new CustomerPayment() { CreditCardNumber = model.CreditCardNumber, SecurityCode = model.SecurityCode, HolderName = model.HolderName, Expiration = model.Expiration, CreditCardBrand = (CreditCardBrandEnum)Convert.ToInt32(model.CreditCardBrand), KeepSave = model.KeepSave }; ticket.Event = eventModel; this.customerService.CreateTicket(ticket, customerPayment, customer); return JsonSuccess(); } catch (System.Exception ex) { return JsonError(ex.Message); } }