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

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

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

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

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

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