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

            context.Remove(await GetPhysicianAsync(id));
            await context.SaveChangesAsync();
        }
        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()));
        }
Beispiel #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()));
        }
Beispiel #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()));
        }
Beispiel #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()));
        }
        public async Task <Physician> UpdatePhysicianAsync(Physician physician)
        {
            using var context = new MedeccContext();

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

            return(physician);
        }
Beispiel #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);
        }
        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()));
        }
Beispiel #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()));
        }
Beispiel #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();
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #14
0
        public Task <IEnumerable <Physician> > GetPhysiciansAsync()
        {
            using var context = new MedeccContext();

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

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