public static TicketRead ToTicketRead(this Ticket ticket) { var azureTicket = new TicketRead(); azureTicket.RowKey = ticket.Id.ToString(); azureTicket.PartitionKey = ticket.Attendee; azureTicket.RowKey = ticket.Id.ToString(); azureTicket.AccessCode = ticket.AccessCode; azureTicket.ParentEventName = ticket.ParentEvent.Name; azureTicket.ParentEventDescription = ticket.ParentEvent.Description; azureTicket.ParentEventDate = ticket.ParentEvent.EventDate; azureTicket.TicketStatus = ticket.Status.ToString(); azureTicket.TotalPrice = ticket.TotalPrice; return azureTicket; }
public void DeleteEvent(Event eventObj) { string partitionKey = eventObj.Organizer; string rowKey = eventObj.Id.ToString(); var eventToDelete = new TicketRead() { PartitionKey = partitionKey, RowKey = rowKey, ETag = "*" }; TableOperation deleteOperation = TableOperation.Delete(eventToDelete); _tableEvents.Execute(deleteOperation); // Invalidate cache _cache.InvalidateCache(GenerateMyEventsKey(partitionKey)); }
public void DeleteTicket(Ticket ticket) { string partitionKey = ticket.Attendee; string rowKey = ticket.Id.ToString(); var ticketToDelete = new TicketRead() { PartitionKey = partitionKey, RowKey = rowKey, ETag = "*" }; TableOperation deleteOperation = TableOperation.Delete(ticketToDelete); _tableTicktes.Execute(deleteOperation); // Invalidate cache _cache.InvalidateCache(GenerateMyTicketsKey(partitionKey)); }