public ActionResult Create(CreateEventViewModel model) { try { var creator = _user.Repository.GetCurrentId.ToString(); model.Invited.Add(creator); if (!ModelState.IsValid || !model.IsValid) { _response.HasFailed("Entered information are not valid."); return(PartialView("_EventResponse", _response as EventResponse)); } var anEvent = model.GetEventFromViewModel; var userEvent = _user.UserEvent(anEvent); _atomicEventWork.Add(anEvent, userEvent); return(JavaScript(RedirectTo.Action(Url, "Index", "Timeline"))); } catch { _response.HasFailed("We apologize, an unexpected error has occured."); return(PartialView("_EventResponse", _response as EventResponse)); } }
private ActionResult RedirectTo(RedirectTo redirect) { if (Url.IsLocalUrl(redirect.Url)) { return(Redirect(redirect.Url)); } return(RedirectToAction(redirect.Action, redirect.Controller)); }