Exemplo n.º 1
0
        public PartialViewResult Edit(TaxonomyBranchPrimaryKey taxonomyBranchPrimaryKey)
        {
            var taxonomyBranch = taxonomyBranchPrimaryKey.EntityObject;
            var viewModel      = new EditViewModel(taxonomyBranch);

            return(ViewEdit(viewModel, taxonomyBranch.TaxonomyTrunk.DisplayName));
        }
Exemplo n.º 2
0
        private PartialViewResult ViewEdit(EditViewModel viewModel, string taxonomyTrunkDisplayName)
        {
            var taxonomyTrunks = HttpRequestStorage.DatabaseEntities.TaxonomyTrunks.ToList()
                                 .OrderBy(x => x.DisplayName)
                                 .ToSelectList(x => x.TaxonomyTrunkID.ToString(CultureInfo.InvariantCulture), x => x.DisplayName);
            var viewData = new EditViewData(taxonomyTrunks, taxonomyTrunkDisplayName);

            return(RazorPartialView <Edit, EditViewData, EditViewModel>(viewData, viewModel));
        }
Exemplo n.º 3
0
        public ActionResult Edit(TaxonomyBranchPrimaryKey taxonomyBranchPrimaryKey, EditViewModel viewModel)
        {
            var taxonomyBranch = taxonomyBranchPrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewEdit(viewModel, taxonomyBranch.TaxonomyTrunk.DisplayName));
            }
            viewModel.UpdateModel(taxonomyBranch, CurrentPerson);
            return(new ModalDialogFormJsonResult());
        }
Exemplo n.º 4
0
        public ActionResult New(EditViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(ViewNew(viewModel));
            }
            var taxonomyBranch = new TaxonomyBranch(viewModel.TaxonomyTrunkID, string.Empty);

            viewModel.UpdateModel(taxonomyBranch, CurrentPerson);
            HttpRequestStorage.DatabaseEntities.TaxonomyBranches.Add(taxonomyBranch);

            HttpRequestStorage.DatabaseEntities.SaveChanges();
            SetMessageForDisplay(string.Format("New {0} {1} successfully created!", FieldDefinition.TaxonomyBranch.GetFieldDefinitionLabel(), taxonomyBranch.GetDisplayNameAsUrl()));
            return(new ModalDialogFormJsonResult());
        }
Exemplo n.º 5
0
 private PartialViewResult ViewNew(EditViewModel viewModel)
 {
     return(ViewEdit(viewModel, string.Empty));
 }
Exemplo n.º 6
0
        public PartialViewResult New()
        {
            var viewModel = new EditViewModel();

            return(ViewNew(viewModel));
        }