Sleep and Steps

- added sleep
- added steps
- bertter DB filling
This commit is contained in:
2018-09-23 18:39:59 +02:00
parent c807c474c4
commit a1019dd62e
17 changed files with 386 additions and 69 deletions

View File

@@ -0,0 +1,24 @@
using Microsoft.AspNetCore.Mvc;
using SeniorAssistant.Data;
namespace SeniorAssistant.Controllers
{
public abstract class BaseController : Controller
{
IDataContextFactory<SeniorDataContext> dbFactory;
SeniorDataContext db;
protected T TryResolve<T>() => (T)HttpContext.RequestServices.GetService(typeof(T));
protected IDataContextFactory<SeniorDataContext> DbFactory => dbFactory ?? (dbFactory = TryResolve<IDataContextFactory<SeniorDataContext>>());
protected SeniorDataContext Db => db ?? (db = DbFactory.Create());
protected override void Dispose(bool disposing)
{
db?.Dispose();
base.Dispose(disposing);
}
}
}