Пример #1
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());
        }
Пример #2
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());
        }