public ActionResult Edit(EditViewModel model) { if (ModelState.IsValid) { if (!User.Identity.IsAuthenticated) { return Redirect("http://localhost:9456/Pages/LoginPage.aspx?publish=true"); } else { currentEvent = model; return RedirectToAction("ChangeEvent"); } } return View(model); }
public ActionResult Edit(int id) { TempEventPhoto = null; var model = new EditViewModel(); var current = new EventManager().GetEventById(id); CreateModel(model, current); model.SelectedTypeId = current.Type.Id; model.SelectedPersonsCategoryId = current.PersonsCategory.Id; 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 }); return View(model); }