public ActionResult SessionView(SessionViewModel viewModel) { if (ModelState.IsValid) { // Store registration } SessionViewModel vm = viewModel; try { var dataItem = Sitecore.Context.Database.GetItem(RenderingContext.Current.Rendering.DataSource); vm = new SessionViewModel(dataItem ?? PageContext.Current.Item); } catch (Exception) { return View(_viewPath, vm); } return View(_viewPath, vm); }
public ActionResult SessionView() { var dataItem = Sitecore.Context.Database.GetItem(RenderingContext.Current.Rendering.DataSource); var viewModel = new SessionViewModel(dataItem ?? PageContext.Current.Item); return View(_viewPath, viewModel); }