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(); }
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(); } }
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()); }
public Repository(DockerContext context) { Context = context; DbSet = Context.Set <T>(); }
public UnitOfWork(DockerContext context) { _context = context; }
public UsuarioRepository(DockerContext context) : base(context) { }
public EnderecoRepository(DockerContext context) : base(context) { }