private PartialViewResult ViewDeleteGrantFile(GrantFileResource grantFileResource, ConfirmDialogFormViewModel viewModel) { var confirmMessage = $"Are you sure you want to delete this \"{grantFileResource.DisplayName}\" file created on '{grantFileResource.FileResource.CreateDate}' by '{grantFileResource.FileResource.CreatePerson.FullNameFirstLast}'?"; var viewData = new ConfirmDialogFormViewData(confirmMessage, true); return(RazorPartialView <ConfirmDialogForm, ConfirmDialogFormViewData, ConfirmDialogFormViewModel>(viewData, viewModel)); }
public void UpdateModel(Models.Grant grant, Person currentPerson) { grant.GrantName = GrantName; grant.ShortName = GrantShortName; grant.OrganizationID = OrganizationID; grant.GrantStatusID = GrantStatusID; grant.GrantTypeID = GrantTypeID; grant.GrantNumber = GrantNumber; grant.CFDANumber = CFDANumber; grant.StartDate = GrantStartDate; grant.EndDate = GrantEndDate; if (GrantFileResourceDatas != null) { // We allow for empty file resources to be posted - at least until such time as they become required. bool anyActualFileResourceDatasSupplied = GrantFileResourceDatas.Any(frd => frd != null); if (anyActualFileResourceDatasSupplied) { foreach (var currentGrantFileResourceData in GrantFileResourceDatas) { Check.EnsureNotNull(currentGrantFileResourceData); var fileResource = FileResource.CreateNewFromHttpPostedFile(currentGrantFileResourceData, currentPerson); HttpRequestStorage.DatabaseEntities.FileResources.Add(fileResource); var grantFileResource = new GrantFileResource(grant, fileResource, fileResource.OriginalCompleteFileName); grant.GrantFileResources.Add(grantFileResource); } } } }