Esempio n. 1
0
 public ActionResult Options(OptionsViewModel model, IPrincipal principal)
 {
     if (!ModelState.IsValid)
     {
         return View(model);
     }
     var u = new UserUpdater(DocumentSession, _ => { });
     if (model.RadioChoiceWatched == "choice-episode")
     {
         u.SetEpisodeWatched(principal.Identity.Name, model.SourceId);
     }
     if (model.RadioChoiceWatched == "choice-season")
     {
         u.SetSeasonWatched(principal.Identity.Name, model.SourceId);
     }
     if (model.RadioChoiceWatched == "choice-custom")
     {
         var foo = model.RadioChoiceCustom.ToLower().Split('x');
         u.SetLastWatchedTo(principal.Identity.Name, model.SourceId, int.Parse(foo[0]), int.Parse(foo[1]));
     }
     return View("Index");
 }
Esempio n. 2
0
        public void TestFullRun()
        {
            using (var store = new DocumentStore { Url = "http://localhost:8080" }.Initialize())
            {
                IndexCreation.CreateIndexes(typeof(SourceShowInfoCaches_ByName).Assembly, store);

                using (var session = store.OpenSession())
                {
                    var updater = new ShowUpdater(session, x => Console.WriteLine("Updated: " + x));
                    updater.UpdateShowNames();
                    session.SaveChanges();
                }

                using (var session = store.OpenSession())
                {
                    var updater = new ShowUpdater(session, x => Console.WriteLine("Updated: " + x));
                    updater.UpdateShowNames();
                    session.SaveChanges();
                }

                using (var session = store.OpenSession())
                {
                    var updater = new ShowUpdater(session, x => Console.WriteLine("Updated: " + x));
                    updater.SeedShow("24496");
                    session.SaveChanges();
                }

                using (var session = store.OpenSession())
                {
                    var updater = new ShowUpdater(session, x => Console.WriteLine("Updated: " + x));
                    updater.UpdateShows();
                    session.SaveChanges();
                }

                using (var session = store.OpenSession())
                {
                    var updater = new UserUpdater(session, x => Console.WriteLine("CreateUser: "******"testve", "2342342434234", "2353465346546");
                    session.SaveChanges();
                }

                using (var session = store.OpenSession())
                {
                    var updater = new UserUpdater(session, x => Console.WriteLine("AddShow: " + x));
                    updater.AddShow("testve", "24496");
                    session.SaveChanges();
                }

                using (var session = store.OpenSession())
                {
                    var updater = new UserUpdater(session, x => Console.WriteLine("AddShow: " + x));
                    updater.SetEpisodeWatched("testve", "24496");
                    session.SaveChanges();
                }

                using (var session = store.OpenSession())
                {
                    var updater = new UserUpdater(session, x => Console.WriteLine("AddShow: " + x));
                    updater.SetSeasonWatched("testve", "24496");
                    session.SaveChanges();
                }
            }
        }