public ActionResult Register(EventRegistrationViewModel model)
 {
     var probableVisitor = from visitor
                           in db.EventRegistrations
                           where visitor.EventId == model.EventId && visitor.VisitorEmail == model.VisitorEmail
                           select visitor;
     if (probableVisitor.Count() == 0)
     {
         db.EventRegistrations.Add(new EventRegistration() { EventId = model.EventId, VisitorEmail = model.VisitorEmail, VisitorName = model.VisitorName });
         db.SaveChanges();
         return View("Success");
     }
     else
     {
         ModelState.AddModelError("VisitorEmail", "Людина з такою поштою вже зареєструвалась на подію");
         return View(model);
     }
 }
 public ActionResult Register(int id)
 {
     var _event = db.Events.Find(id);
     if (_event == null)
         return HttpNotFound();
     if (_event.Till < DateTime.Now)
         return View("NoRegistration");
     EventRegistrationViewModel model = new EventRegistrationViewModel() { EventName = _event.Name, EventId = id, PosterPath = _event.PosterPath };
     return View(model);
 }