public static async Task <EventEntity> GetEventByIdAsync(
            this CoreDbContext coreDbContext,
            string id)
        {
            var ev = await coreDbContext.Events.FindAsync(id);

            if (ev != null)
            {
                ev.Region = await coreDbContext.GetRegionByIdAsync(ev.RegionId);
            }

            return(ev);
        }
Exemple #2
0
        public static async Task <CoreDbContext> AddRegionAsync(
            this CoreDbContext coreDbContext, string parentId, string name)
        {
            var id = string.Empty;

            if (parentId != Constants.RootRegionId)
            {
                id += parentId + "/";
            }
            id += name.ToLower().Replace(' ', '-');

            await coreDbContext.Regions.AddAsync(new RegionEntity()
            {
                Id       = id,
                ParentId = parentId,
                DataJson = JsonConvert.SerializeObject(new
                {
                    Name = name
                }),
                DataJsonVersion = 1
            });

            return(coreDbContext);
        }
 public static async Task <IEnumerable <RegionMembershipEntity> > GetRegionMembershipsAsync(
     this CoreDbContext coreDbContext,
     string userEmail) =>
 (await coreDbContext.RegionMemberships
  .Where(rm => rm.UserEmail.Equals(userEmail, StringComparison.OrdinalIgnoreCase))
  .ToListAsync()).AsEnumerable();