public Dictionary <string, AttributeValue> ToDictionary() { var map = new Dictionary <string, AttributeValue> { ["id"] = new AttributeValue("post"), ["postId"] = new AttributeValue { N = Id.ToString() }, ["postText"] = new AttributeValue(Text), ["hashTag"] = new AttributeValue(HashTag), ["unixTimestamp"] = new AttributeValue { N = UnixTimestamp.ToString() }, ["dayNumber"] = new AttributeValue { N = DayNumber.ToString() } }; if (!string.IsNullOrEmpty(VideoAttachment)) { map["videoAttachments"] = new AttributeValue { L = new List <AttributeValue> { new AttributeValue { M = new Dictionary <string, AttributeValue> { ["src"] = new AttributeValue(VideoAttachment) } } } }; } if (PhotoAttachments.Any()) { map["photoAttachments"] = new AttributeValue { L = PhotoAttachments.Select(a => new AttributeValue { M = a.ToDictionary() }).ToList() }; } return(map); }
public override string ToString() => DayNumber.ToString();