示例#1
0
 public ActionResult JobResults()
 {
     using (var context = new DockerContext())
     {
         var allJobResults = context.JobResults.ToList().Select(jr => new JobResultViewModel(jr)).OrderByDescending(r => r.Created).ToList();
         return(View(allJobResults));
     }
 }
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, DockerContext context)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });

            context.Database.EnsureCreated();
        }
示例#3
0
        public void DoTheJob()
        {
            var _timeToSleepMS = 1000 * 60;

            //TODO: use IoC http://docs.hangfire.io/en/latest/background-methods/using-ioc-containers.html
            Thread.Sleep(_timeToSleepMS);
            using (var context = new DockerContext())
            {
                var jobResult = new JobResult()
                {
                    CreateDate  = DateTime.UtcNow,
                    MachineName = System.Environment.MachineName,
                    Result      = $"I've Slept for {_timeToSleepMS} ms"
                };
                context.JobResults.Add(jobResult);
                context.SaveChanges();
            }
        }
示例#4
0
        public ActionResult Index()
        {
            ViewBag.VisitCount = 1;
            string ipAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];

            if (string.IsNullOrEmpty(ipAddress))
            {
                ipAddress = Request.ServerVariables["REMOTE_ADDR"];
            }
            using (var context = new DockerContext())
            {
                var visit = new DockerData.Entities.Visit()
                {
                    IPAddress  = ipAddress,
                    CreateDate = DateTime.UtcNow
                };
                context.Visits.Add(visit);
                context.SaveChanges();
                ViewBag.VisitCount = context.Visits.Count();
            }
            return(View());
        }
示例#5
0
 public Repository(DockerContext context)
 {
     Context = context;
     DbSet   = Context.Set <T>();
 }
 public UnitOfWork(DockerContext context)
 {
     _context = context;
 }
示例#7
0
 public UsuarioRepository(DockerContext context) : base(context)
 {
 }
示例#8
0
 public EnderecoRepository(DockerContext context) : base(context)
 {
 }