Esempio n. 1
0
 public ActionResult Index(Subscriber subscriber)
 {
     if (ModelState.IsValid)
     {
         var existing = _subscriberRepo.FindAll(s => s.Email == subscriber.Email);
             subscriber.ID = Guid.NewGuid();
             _subscriberRepo.Save(subscriber);
             ViewBag.SaveMessage = "Prenumeration påbörjad!";
             var vm = new vm_PostSubscriber();
             vm.Post = _postRepo.FindAll().Take(3).ToList();
             return View(vm);
     }
     else
     {
         ViewBag.SaveMessage = "Subscription unsuccessful";
         return View();
     }
 }
Esempio n. 2
0
 public ActionResult Index()
 {
     var vm = new vm_PostSubscriber();
         vm.Post = _postRepo.FindAll().Take(3).OrderByDescending(p => p.Date).ToList();
     return View(vm);
 }