Пример #1
0
 private bool ExistsRssFutureAccess(FutureRssAccess input)
 {
     var exists = RavenSession.Query<FutureRssAccess>()
         .Any(x => x.ExpiredOn == input.ExpiredOn &&
                   x.NumberOfFutureDays == input.NumberOfFutureDays &&
                   x.User == input.User);
     return exists;
 }
Пример #2
0
        public virtual ActionResult RssFutureAccess(FutureRssAccess input)
        {
            ValidateConfiguration();

            if (ExistsRssFutureAccess(input))
            {
                ModelState.AddModelError("Exists", "Access has already been set up with same parameters.");
            }

            if (ModelState.IsValid == false)
            {
                SetFutureRssAccessList(RavenSession);
                return View(input);
            }

            input.Token = GetFutureAccessToken(input.ExpiredOn, input.NumberOfFutureDays, input.User);

            RavenSession.Store(input);
            RavenSession.SaveChanges();

            SetFutureRssAccessList(RavenSession);

            return View(input);
        }