Ejemplo n.º 1
0
 /// <summary>
 /// Edits the model reference.
 /// </summary>
 /// <returns></returns>
 public ActionResult EditModelReference()
 {
     var currentModel = _session.Query<IPageModel>().SingleOrDefault(x => x.Parent == null);
     var viewModel = new EditModelReferenceModel
                         {
                             RootModel = currentModel,
                             CurrentModel = currentModel,
                             BackAction = "Index",
                             Message = "Foo",
                             Children = _session.Query<IPageModel>()
                                 .Where(x => x.Parent.Id == currentModel.Id)
                         };
     return PartialView(viewModel);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the children model.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        public ActionResult GetChildrenModel(string id)
        {
            var currentModel = _session.Load<IPageModel>(id);

            var rootModel = currentModel.Parent == null ? _session.Query<IPageModel>().SingleOrDefault(x => x.Parent == null) : null;

            var viewModel = new EditModelReferenceModel
            {
                RootModel = rootModel,
                CurrentModel = currentModel,
                ParentModel = currentModel.Parent != null ? _session.Query<IPageModel>().SingleOrDefault(x => x.Id == currentModel.Parent.Id) : null,
                BackAction = "Index",
                Message = "Foo",
                Children = _session.Query<IPageModel>()
                    .Where(x => x.Parent.Id == id)
            };

            return PartialView("_Menu",viewModel);
        }