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());
                }
            }
        }
Пример #2
0
 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();
     }
 }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
        // 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());
        }
Пример #6
0
        // 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));
            }
        }
Пример #7
0
 public BlogController(IUnitOfWork unitOfWork, IHostingEnvironment environment, EF.SampleDbContext context)
 {
     this.context    = context;
     this.unitOfWork = unitOfWork;
     _environment    = environment;
 }
Пример #8
0
 public UnitOfWork(EF.SampleDbContext dbContext)
 {
     _dbContext = dbContext;
 }
Пример #9
0
 public GenericRepository(EF.SampleDbContext dbContext)
 {
     _dbContext = dbContext;
 }