示例#1
0
        private PartialViewResult ViewDeleteProjectCustomAttributeGroup(ProjectCustomAttributeGroup projectCustomAttributeGroup, ConfirmDialogFormViewModel viewModel, string message = null)
        {
            bool canDelete     = !projectCustomAttributeGroup.ProjectCustomAttributeTypes.Any();
            var  deleteMessage = message ?? (canDelete
                                    ? $"Are you sure you want to delete {FieldDefinitionEnum.ProjectCustomAttributeGroup.ToType().GetFieldDefinitionLabel()} \"{projectCustomAttributeGroup.ProjectCustomAttributeGroupName}\"?"
                                    : ConfirmDialogFormViewData.GetStandardCannotDeleteMessage(projectCustomAttributeGroup.ProjectCustomAttributeGroupName, SitkaRoute <ProjectCustomAttributeTypeController> .BuildLinkFromExpression(x => x.Manage(), "here")));

            var viewData = new ConfirmDialogFormViewData(deleteMessage, canDelete);

            return(RazorPartialView <ConfirmDialogForm, ConfirmDialogFormViewData, ConfirmDialogFormViewModel>(viewData, viewModel));
        }
示例#2
0
        private PartialViewResult ViewEdit(EditViewModel viewModel, ProjectCustomAttributeGroup projectCustomAttributeGroup)
        {
            var instructionsFirmaPage = FirmaPageTypeEnum.ManageProjectCustomAttributeGroupInstructions.GetFirmaPage();
            var submitUrl             = ModelObjectHelpers.IsRealPrimaryKeyValue(viewModel.ProjectCustomAttributeGroupID)
                ? SitkaRoute <ProjectCustomAttributeGroupController> .BuildUrlFromExpression(x => x.Edit(viewModel.ProjectCustomAttributeGroupID))
                : SitkaRoute <ProjectCustomAttributeGroupController> .BuildUrlFromExpression(x => x.New());

            var viewData = new EditViewData(CurrentFirmaSession, submitUrl, instructionsFirmaPage, projectCustomAttributeGroup);

            return(RazorPartialView <Edit, EditViewData, EditViewModel>(viewData, viewModel));
        }
示例#3
0
        public ActionResult New(EditViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(ViewEdit(viewModel, null));
            }

            var projectCustomAttributeGroup = ProjectCustomAttributeGroup.CreateNewBlank();

            viewModel.UpdateModel(projectCustomAttributeGroup, CurrentFirmaSession);

            HttpRequestStorage.DatabaseEntities.AllProjectCustomAttributeGroups.Add(projectCustomAttributeGroup);
            HttpRequestStorage.DatabaseEntities.SaveChanges();
            SetMessageForDisplay($"{FieldDefinitionEnum.ProjectCustomAttributeGroup.ToType().GetFieldDefinitionLabel()} {projectCustomAttributeGroup.ProjectCustomAttributeGroupName} successfully created.");

            return(new ModalDialogFormJsonResult());
        }
 public static string GetProjectCategoryDisplayNamesAsCommaDelimitedList(this ProjectCustomAttributeGroup projectCustomAttributeGroup)
 {
     return(string.Join(", ", projectCustomAttributeGroup.ProjectCustomAttributeGroupProjectCategories.Select(x => x.ProjectCategory.ProjectCategoryDisplayName).ToList()));
 }
 public static string GetEditUrl(this ProjectCustomAttributeGroup projectCustomAttributeGroup) => EditUrlTemplate.ParameterReplace(projectCustomAttributeGroup.ProjectCustomAttributeGroupID);