Ejemplo n.º 1
0
        public PartialViewResult Edit(TaxonomyTrunkPrimaryKey taxonomyTrunkPrimaryKey)

        {
            var taxonomyTrunk = taxonomyTrunkPrimaryKey.EntityObject;
            var viewModel     = new EditViewModel(taxonomyTrunk);

            return(ViewEdit(viewModel));
        }
Ejemplo n.º 2
0
        public ActionResult Edit(TaxonomyTrunkPrimaryKey taxonomyTrunkPrimaryKey, EditViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(ViewEdit(viewModel));
            }

            var taxonomyTrunk = taxonomyTrunkPrimaryKey.EntityObject;

            viewModel.UpdateModel(taxonomyTrunk, CurrentPerson);
            return(new ModalDialogFormJsonResult());
        }
Ejemplo n.º 3
0
        public ActionResult New(EditViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(ViewEdit(viewModel));
            }

            var taxonomyTrunk = new TaxonomyTrunk(string.Empty);

            viewModel.UpdateModel(taxonomyTrunk, CurrentPerson);
            HttpRequestStorage.DatabaseEntities.TaxonomyTrunks.Add(taxonomyTrunk);

            HttpRequestStorage.DatabaseEntities.SaveChanges();
            SetMessageForDisplay(
                $"New {FieldDefinition.TaxonomyTrunk.GetFieldDefinitionLabel()} {taxonomyTrunk.GetDisplayNameAsUrl()} successfully created!");
            return(new ModalDialogFormJsonResult());
        }
Ejemplo n.º 4
0
        private PartialViewResult ViewEdit(EditViewModel viewModel)
        {
            var viewData = new EditViewData();

            return(RazorPartialView <Edit, EditViewData, EditViewModel>(viewData, viewModel));
        }
Ejemplo n.º 5
0
        public PartialViewResult New()
        {
            var viewModel = new EditViewModel();

            return(ViewEdit(viewModel));
        }