Ejemplo n.º 1
0
 public List <Application> GetAllApplications()
 {
     using (var context = new HealthCheckerContext())
     {
         return(context.Applications.ToList());
     }
 }
Ejemplo n.º 2
0
 public Application GetApplicationByName(string applicationName)
 {
     using (var context = new HealthCheckerContext())
     {
         return(context.Applications.FirstOrDefault(x => x.Name == applicationName));
     }
 }
Ejemplo n.º 3
0
 public async Task <Application> GetApplicationById(long applicationId)
 {
     using (var context = new HealthCheckerContext())
     {
         return(await context.Applications.FindAsync(applicationId));
     }
 }
Ejemplo n.º 4
0
 public async Task DeleteApplication(Application application)
 {
     using (var context = new HealthCheckerContext())
     {
         context.Applications.Remove(application);
         await context.SaveChangesAsync();
     }
 }
Ejemplo n.º 5
0
        public async Task <Application> AddApplication(Application application)
        {
            using (var context = new HealthCheckerContext())
            {
                context.Applications.Add(application);
                await context.SaveChangesAsync();

                return(application);
            }
        }
Ejemplo n.º 6
0
        public async Task <Application> UpdateApplication(Application application)
        {
            using (var context = new HealthCheckerContext())
            {
                var dbApplication = context.Applications.Find(application.ApplicationId);
                context.Entry(dbApplication).CurrentValues.SetValues(application);
                await context.SaveChangesAsync();

                return(application);
            }
        }