Example #1
0
        public async Task Delete(
            D.ParticipantClaim c)
        {
            var q =
                from a in _ctx.Appointments
                from p in a.Participants
                where a.ScheduleName == c.Schedule &&
                a.Start == c.Start &&
                p.SubjectId == c.SubjectId
                select p;

            var participation = await q.SingleOrDefaultAsync();

            if (participation != null)
            {
                _ctx.Remove(participation);
                await _ctx.SaveChangesAsync();
            }
        }
Example #2
0
        public async Task <D.Participation[]> Get(
            D.ParticipantClaim c)
        {
            var q =
                from a in _ctx.Appointments
                from p in a.Participants
                orderby p.Name
                where
                a.Schedule.Name == c.Schedule &&
                a.Start == c.Start &&
                a.Participants.Any(x => x.SubjectId == c.SubjectId)
                select new D.Participation
            {
                SubjectId = p.SubjectId,
                Name      = p.Name
            };

            return(await q.ToArrayAsync());
        }