public static EventRead ToEventRead(this Event myEvent) { var azureEvent = new EventRead(); azureEvent.PartitionKey = myEvent.EventDate.Year.ToString(); azureEvent.RowKey = myEvent.Id.ToString(); azureEvent.AvailableSeats = myEvent.AvailableSeats; azureEvent.Description = myEvent.Description; azureEvent.Organizer = myEvent.Organizer; azureEvent.Name = myEvent.Name; azureEvent.EventDate = myEvent.EventDate; azureEvent.TicketPrice = myEvent.TicketPrice; azureEvent.TotalSeats = myEvent.TotalSeats; return(azureEvent); }
public static Event ToEvent(this EventRead eventAzure) { var eventObj = new Event(); eventObj.Id = Guid.Parse(eventAzure.RowKey); eventObj.Organizer = eventAzure.PartitionKey; eventObj.AvailableSeats = eventAzure.AvailableSeats; eventObj.Description = eventAzure.Description; eventObj.EventDate = eventAzure.EventDate; eventObj.Name = eventAzure.Name; if (eventAzure.Status == "Draft") { eventObj.Status = EventStatus.Draft; } if (eventAzure.Status == "Live") { eventObj.Status = EventStatus.Live; } eventObj.TicketPrice = eventAzure.TicketPrice; eventObj.TotalSeats = eventAzure.TotalSeats; return(eventObj); }