src/fursvp.data/Firestore/EventMapper.cs
/// <summary>
/// Converts from Event to Dictionary.
/// </summary>
/// <param name="event">The Event to convert.</param>
/// <returns>The Dictionary of variables.</returns>
Converts from Event to Dictionary.
Converts from Event to Dictionary .
public Dictionary<string, object> ToDictionary(Event @event)
        {
            if (@event == null)
            {
                throw new ArgumentNullException(nameof(@event));
            }
            return new Dictionary<string, object>
            {
                { nameof(@event.Id), @event.Id.ToString() },
                { nameof(@event.Version), @event.Version },
                { nameof(@event.StartsAtUtc), @event.StartsAtUtc.ToUniversalTime() },
                { nameof(@event.EndsAtUtc), @event.EndsAtUtc.ToUniversalTime() },
                { nameof(@event.TimeZoneId), @event.TimeZoneId },
                {
                    nameof(@event.Members), @event.Members.Select(m => new Dictionary<string, object>
                    {
                        { nameof(m.Id), m.Id.ToString() },
                        { nameof(m.EmailAddress), m.EmailAddress },
                        { nameof(m.Name), m.Name },
                        { nameof(m.IsAttending), m.IsAttending },
                        { nameof(m.IsOrganizer), m.IsOrganizer },
                        { nameof(m.IsAuthor), m.IsAuthor },
                        { nameof(m.RsvpedAtUtc), m.RsvpedAtUtc.ToUniversalTime() },
                        {
                            nameof(m.Responses), m.Responses.Select(r => new Dictionary<string, object>
                            {
                                { nameof(r.PromptId), r.PromptId.ToString() },
                                { nameof(r.Responses), r.Responses.ToList() },
                            }).ToList()
                        },
                    }).ToList()
                },
                {
                    nameof(@event.Form), @event.Form.Select(f => new Dictionary<string, object>
                    {
                        { nameof(f.Id), f.Id.ToString() },
                        { nameof(f.Behavior), f.Behavior },
                        { nameof(f.Prompt), f.Prompt },
                        { nameof(f.Options), f.Options.ToList() },
                        { nameof(f.SortOrder), f.SortOrder },
                        { nameof(f.Required), f.Required },
                    }).ToList()
                },
                { nameof(@event.Name), @event.Name },
                { nameof(@event.OtherDetails), @event.OtherDetails },
                { nameof(@event.Location), @event.Location },
                { nameof(@event.RsvpOpen), @event.RsvpOpen },
                { nameof(@event.RsvpClosesAtUtc), @event.RsvpClosesAtUtc?.ToUniversalTime() },
                { nameof(@event.IsPublished), @event.IsPublished },
            };
        }
public Dictionary < string , object > ToDictionary ( Event @event ) { if ( @event == null ) { throw new ArgumentNullException ( nameof ( @event ) ) ; } return new Dictionary < string , object > { { nameof ( @event . Id ) , @event . Id . ToString ( ) } , { nameof ( @event . Version ) , @event . Version } , { nameof ( @event . StartsAtUtc ) , @event . StartsAtUtc . ToUniversalTime ( ) } , { nameof ( @event . EndsAtUtc ) , @event . EndsAtUtc . ToUniversalTime ( ) } , { nameof ( @event . TimeZoneId ) , @event . TimeZoneId } , { nameof ( @event . Members ) , @event . Members . Select ( m => new Dictionary < string , object > { { nameof ( m . Id ) , m . Id . ToString ( ) } , { nameof ( m . EmailAddress ) , m . EmailAddress } , { nameof ( m . Name ) , m . Name } , { nameof ( m . IsAttending ) , m . IsAttending } , { nameof ( m . IsOrganizer ) , m . IsOrganizer } , { nameof ( m . IsAuthor ) , m . IsAuthor } , { nameof ( m . RsvpedAtUtc ) , m . RsvpedAtUtc . ToUniversalTime ( ) } , { nameof ( m . Responses ) , m . Responses . Select ( r => new Dictionary < string , object > { { nameof ( r . PromptId ) , r . PromptId . ToString ( ) } , { nameof ( r . Responses ) , r . Responses . ToList ( ) } , } ) . ToList ( ) } , } ) . ToList ( ) } , { nameof ( @event . Form ) , @event . Form . Select ( f => new Dictionary < string , object > { { nameof ( f . Id ) , f . Id . ToString ( ) } , { nameof ( f . Behavior ) , f . Behavior } , { nameof ( f . Prompt ) , f . Prompt } , { nameof ( f . Options ) , f . Options . ToList ( ) } , { nameof ( f . SortOrder ) , f . SortOrder } , { nameof ( f . Required ) , f . Required } , } ) . ToList ( ) } , { nameof ( @event . Name ) , @event . Name } , { nameof ( @event . OtherDetails ) , @event . OtherDetails } , { nameof ( @event . Location ) , @event . Location } , { nameof ( @event . RsvpOpen ) , @event . RsvpOpen } , { nameof ( @event . RsvpClosesAtUtc ) , @event . RsvpClosesAtUtc ? . ToUniversalTime ( ) } , { nameof ( @event . IsPublished ) , @event . IsPublished } , } ; }
Converts from Event to Dictionary.
Converts from Event to Dictionary .
The Dictionary of variables.
The Dictionary of variables .
@event
Event
event
The Event to convert.
The Event to convert .