private PartialViewResult ViewDeleteGrantAllocationAward(GrantAllocationAward grantAllocationAward, ConfirmDialogFormViewModel viewModel) { var canDelete = !grantAllocationAward.HasDependentObjects(); var confirmMessage = canDelete ? $"Are you sure you want to delete this {FieldDefinition.GrantAllocationAward.GetFieldDefinitionLabel()} '{grantAllocationAward.GrantAllocationAwardName}'?" : ConfirmDialogFormViewData.GetStandardCannotDeleteMessage(FieldDefinition.GrantAllocationAward.GetFieldDefinitionLabel(), SitkaRoute <GrantAllocationAwardController> .BuildLinkFromExpression(x => x.GrantAllocationAwardDetail(grantAllocationAward), "here")); var viewData = new ConfirmDialogFormViewData(confirmMessage, canDelete); return(RazorPartialView <ConfirmDialogForm, ConfirmDialogFormViewData, ConfirmDialogFormViewModel>(viewData, viewModel)); }
public ActionResult NewForAFocusArea(FocusAreaPrimaryKey focusAreaPrimaryKey, EditGrantAllocationAwardViewModel viewModel) { if (!ModelState.IsValid) { return(GrantAllocationAwardViewEdit(viewModel)); } var grantAllocation = HttpRequestStorage.DatabaseEntities.GrantAllocations.Single(ga => ga.GrantAllocationID == viewModel.GrantAllocationID); var focusArea = HttpRequestStorage.DatabaseEntities.FocusAreas.Single(fa => fa.FocusAreaID == viewModel.FocusAreaID); var grantAllocationAward = GrantAllocationAward.CreateNewBlank(grantAllocation, focusArea); viewModel.UpdateModel(grantAllocationAward); return(new ModalDialogFormJsonResult()); }