public PartialViewResult Edit(ProjectCustomAttributeGroupPrimaryKey projectCustomAttributeGroupPrimaryKey) { var projectCustomAttributeGroup = projectCustomAttributeGroupPrimaryKey.EntityObject; var viewModel = new EditViewModel(projectCustomAttributeGroup); return(ViewEdit(viewModel, projectCustomAttributeGroup)); }
public PartialViewResult DeleteProjectCustomAttributeGroup(ProjectCustomAttributeGroupPrimaryKey projectCustomAttributeGroupPrimaryKey) { var projectCustomAttributeGroup = projectCustomAttributeGroupPrimaryKey.EntityObject; var viewModel = new ConfirmDialogFormViewModel(projectCustomAttributeGroup.ProjectCustomAttributeGroupID); return(ViewDeleteProjectCustomAttributeGroup(projectCustomAttributeGroup, viewModel)); }
public ActionResult Edit(ProjectCustomAttributeGroupPrimaryKey projectCustomAttributeGroupPrimaryKey, EditViewModel viewModel) { var projectCustomAttributeGroup = projectCustomAttributeGroupPrimaryKey.EntityObject; if (!ModelState.IsValid) { return(ViewEdit(viewModel, projectCustomAttributeGroup)); } viewModel.UpdateModel(projectCustomAttributeGroup, CurrentFirmaSession); return(new ModalDialogFormJsonResult()); }
public ActionResult DeleteProjectCustomAttributeGroup(ProjectCustomAttributeGroupPrimaryKey projectCustomAttributeGroupPrimaryKey, ConfirmDialogFormViewModel viewModel) { var projectCustomAttributeGroup = projectCustomAttributeGroupPrimaryKey.EntityObject; bool canDelete = !projectCustomAttributeGroup.ProjectCustomAttributeTypes.Any(); if (!canDelete) { return(ViewDeleteProjectCustomAttributeGroup(projectCustomAttributeGroup, viewModel, ConfirmDialogFormViewData.GetStandardCannotDeleteMessage(projectCustomAttributeGroup.ProjectCustomAttributeGroupName, SitkaRoute <ProjectCustomAttributeTypeController> .BuildLinkFromExpression(x => x.Manage(), "here")))); } if (!ModelState.IsValid) { return(ViewDeleteProjectCustomAttributeGroup(projectCustomAttributeGroup, viewModel)); } var message = $"{FieldDefinitionEnum.ProjectCustomAttribute.ToType().GetFieldDefinitionLabel()} '{projectCustomAttributeGroup.ProjectCustomAttributeGroupName}' successfully deleted!"; projectCustomAttributeGroup.DeleteFull(HttpRequestStorage.DatabaseEntities); SetMessageForDisplay(message); return(new ModalDialogFormJsonResult()); }
public ActionResult New(EditViewModel viewModel) { if (!ModelState.IsValid) { return(ViewEdit(viewModel, null)); } ProjectCustomAttributeGroupPrimaryKey projectCustomAttributeGroupPrimaryKey = viewModel.ProjectCustomAttributeGroupID; var projectCustomAttributeGroup = projectCustomAttributeGroupPrimaryKey.EntityObject; var projectCustomAttributeType = new ProjectCustomAttributeType(String.Empty, ProjectCustomAttributeDataType.String, false, false, projectCustomAttributeGroup); viewModel.UpdateModel(projectCustomAttributeType, CurrentFirmaSession); HttpRequestStorage.DatabaseEntities.AllProjectCustomAttributeTypes.Add(projectCustomAttributeType); HttpRequestStorage.DatabaseEntities.SaveChanges(); SetMessageForDisplay($"{FieldDefinitionEnum.ProjectCustomAttribute.ToType().GetFieldDefinitionLabel()} {projectCustomAttributeType.ProjectCustomAttributeTypeName} successfully created."); SetWarningAboutHiddenRequiredAttributesIfNeeded(projectCustomAttributeType); return(new ModalDialogFormJsonResult()); }