public IActionResult Confirmation() { var userId = Request.Query["userid"].ToString(); var code = Request.Query["code"].ToString(); using (var context = new EF.SampleDbContext()) { var rec = context.User.FirstOrDefault(x => x.ConfirmationCode == code); if (rec != null) { if (Convert.ToDateTime(rec.ConfirmationExpiry) < DateTime.Now) { return(NotFound()); } return(View(new Models.ChangePassword { UserId = rec.UserId })); } else { return(NotFound()); } } }
public async Task Edit(EF.Setting args) { using (var context = new EF.SampleDbContext()) { var row = context.Setting.First(x => x.SettingId == args.SettingId); row.Value = args.Value; await context.SaveChangesAsync(); } }
public bool Match(HttpContext httpContext, IRouter route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection) { var context = new EF.SampleDbContext(); if (values[parameterName] != null) { var permalink = values[parameterName].ToString(); return(context.Page.Any(p => p.Permalink == permalink)); } return(false); }
public ValidateReCaptchaAttribute(IConfiguration configuration) { if (configuration == null) { throw new ArgumentNullException("configuration"); } var context = new EF.SampleDbContext(); this.m_configuration = configuration; this.m_reCaptchaSecret = new Lazy <string>(() => context.Setting.First(x => x.Group == "Recaptcha" && x.Key == "Recaptcha private key").Value); }
// GET: /<controller>/ public async Task <IActionResult> Index() { var context = new EF.SampleDbContext(); var template = (await new BLL.Template(unitOfWork).Find(new EF.Template())).Where(x => x.DateInactive == null).First(); ViewData["Title"] = "Sections"; ViewBag.Data = await new BLL.Section(unitOfWork).Find(new EF.Section { TemplateId = template.TemplateId }); return(View()); }
// GET: /<controller>/ public async Task <IActionResult> Index(string permalink) { var context = new EF.SampleDbContext(); var rec = await new BLL.Page(unitOfWork).Get(new EF.Page { Permalink = permalink }); if (rec != null) { ViewData["Title"] = rec.Title; return(View(rec)); } else { return(StatusCode(404)); } }
public BlogController(IUnitOfWork unitOfWork, IHostingEnvironment environment, EF.SampleDbContext context) { this.context = context; this.unitOfWork = unitOfWork; _environment = environment; }
public UnitOfWork(EF.SampleDbContext dbContext) { _dbContext = dbContext; }
public GenericRepository(EF.SampleDbContext dbContext) { _dbContext = dbContext; }