public ActionResult Index(EventViewModel model) { if (ModelState.IsValid) { currentEvent = model; if (!User.Identity.IsAuthenticated) { return Redirect("http://localhost:9456/Pages/LoginPage.aspx?publish=true"); } else { return RedirectToAction("SaveEvent"); } } model.SelectedCountryId = 0; SetModelCollections(model); return View(model); }
public void SetModelCollections(EventViewModel model) { model.EventTypes = store.GetAllEventTypes().OrderBy(t => t.Type) .Select(eType => new SelectListItem { Value = eType.Id.ToString(), Text = eType.Type }); model.EventPersonCategories = store.GetAllPersonCategories().OrderBy(c => c.Category) .Select(eCat => new SelectListItem { Value = eCat.Id.ToString(), Text = eCat.Category }); model.Countries = store.GetAllCountries().OrderBy(c => c.Country) .Select(eC => new SelectListItem { Value = eC.Id.ToString(), Text = eC.Country }); model.MainPhoto = new PhotoManager().GetImage(null, Server.MapPath("~"), true); }
public ActionResult Index() { EventViewModel model = new EventViewModel(); SetModelCollections(model); return View(model); }