Example #1
0
        public async Task DeletePhysicianAsync(string id)
        {
            using var context = new MedeccContext();

            context.Remove(await GetPhysicianAsync(id));
            await context.SaveChangesAsync();
        }
Example #2
0
        public Task <Physician> GetPhysicianAsync(string id)
        {
            using var context = new MedeccContext();

            return(Task.FromResult((from c in context.Caregivers
                                    where c.Id == id
                                    select c).FirstOrDefault()));
        }
Example #3
0
        public Task <ApplicationLogin> FindByIdAsync(string id)
        {
            using var context = new MedeccContext();

            return(Task.FromResult((from a in context.ApplicationLogins
                                    where a.Id == id
                                    select a).FirstOrDefault()));
        }
Example #4
0
        public Task <ApplicationLogin> FindByNormalizedUserNameAsync(string normalizedUserName)
        {
            using var context = new MedeccContext();

            return(Task.FromResult((from a in context.ApplicationLogins
                                    where a.NormalizedUserName == normalizedUserName
                                    select a).FirstOrDefault()));
        }
Example #5
0
        public Task <Media> GetMedia(string id)
        {
            using var context = new MedeccContext();

            return(Task.FromResult((from m in context.Media
                                    where m.Id == id
                                    select m).FirstOrDefault()));
        }
Example #6
0
        public async Task <Physician> UpdatePhysicianAsync(Physician physician)
        {
            using var context = new MedeccContext();

            context.Update(physician);
            await context.SaveChangesAsync();

            return(physician);
        }
Example #7
0
        public async Task <ApplicationLogin> UpdateApplicationLoginAsync(ApplicationLogin applicationLogin)
        {
            using var context = new MedeccContext();

            var @return = context.Update(applicationLogin);
            await context.SaveChangesAsync();

            return(@return.Entity);
        }
Example #8
0
        public Task <IEnumerable <Physician> > GetPhysicianTeam(string id)
        {
            using var context = new MedeccContext();

            var caregiverTeam = from c in context.Caregivers
                                where c.SupervisorId == id
                                select c;

            return(Task.FromResult((IEnumerable <Physician>)caregiverTeam.ToArray()));
        }
Example #9
0
        public Task <IEnumerable <Message> > GetMessagesByGroup(string groupId)
        {
            using var context = new MedeccContext();

            var messages = from m in context.Messages
                           where m.GroupId == groupId
                           select m;

            return(Task.FromResult((IEnumerable <Message>)messages.Include(m => m.Stats).ToArray()));
        }
Example #10
0
        public async Task AddApplicationLoginAsync(ApplicationLogin applicationLogin)
        {
            var id = Guid.NewGuid().ToString("N");;

            applicationLogin.Id = id;

            using var context = new MedeccContext();
            await context.AddAsync(applicationLogin);

            await context.SaveChangesAsync();
        }
Example #11
0
        public async Task <Physician> AddPhysicianAsync(Physician physician)
        {
            using var context = new MedeccContext();

            physician.Id = Guid.NewGuid().ToString("N");;

            await context.AddAsync(physician);

            await context.SaveChangesAsync();

            return(physician);
        }
Example #12
0
        public async Task <string> AddMedia(Media media)
        {
            using var context = new MedeccContext();

            var id = Guid.NewGuid().ToString("N");;

            media.Id = id;
            await context.AddAsync(media);

            await context.SaveChangesAsync();

            return(id);
        }
Example #13
0
        public async Task <string> AddMessage(Message message)
        {
            message.Id = Guid.NewGuid().ToString("N");;

            if (message.Stats != null)
            {
                message.Stats.Id = Guid.NewGuid().ToString("N");;
            }

            using var context = new MedeccContext();

            await context.AddAsync(message);

            await context.SaveChangesAsync();

            return(message.Id);
        }
Example #14
0
        public Task <IEnumerable <Physician> > GetPhysiciansAsync()
        {
            using var context = new MedeccContext();

            return(Task.FromResult((IEnumerable <Physician>)context.Caregivers.ToArray()));
        }
Example #15
0
        public Task <IEnumerable <ApplicationLogin> > GetApplicationLoginsAsync()
        {
            using var context = new MedeccContext();

            return(Task.FromResult((IEnumerable <ApplicationLogin>)context.ApplicationLogins.ToArray()));
        }