public PartialViewResult EditGrantNote(GrantNotePrimaryKey grantNotePrimaryKey) { var grantNote = grantNotePrimaryKey.EntityObject; var viewModel = new EditGrantNoteViewModel(grantNote); return(ViewEditNote(viewModel, EditGrantNoteType.ExistingNote)); }
public ActionResult EditGrantNote(GrantNotePrimaryKey grantNotePrimaryKey, EditGrantNoteViewModel viewModel) { if (!ModelState.IsValid) { return ViewEditNote(viewModel, EditGrantNoteType.ExistingNote); } var grantNote = grantNotePrimaryKey.EntityObject; viewModel.UpdateModel(grantNote, CurrentPerson, EditGrantNoteType.ExistingNote); HttpRequestStorage.DatabaseEntities.GrantNotes.AddOrUpdate(grantNote); SetMessageForDisplay($"{FieldDefinition.GrantNote.GetFieldDefinitionLabel()} has been updated."); return new ModalDialogFormJsonResult(); }
public ActionResult NewGrantNote(GrantPrimaryKey grantPrimaryKey, EditGrantNoteViewModel viewModel) { if (!ModelState.IsValid) { return(ViewEditNote(viewModel, EditGrantNoteType.NewNote)); } var grant = grantPrimaryKey.EntityObject; var grantNote = GrantNote.CreateNewBlank(grant, CurrentPerson); viewModel.UpdateModel(grantNote, CurrentPerson, EditGrantNoteType.NewNote); HttpRequestStorage.DatabaseEntities.GrantNotes.Add(grantNote); SetMessageForDisplay($"{FieldDefinition.GrantNote.GetFieldDefinitionLabel()} has been created."); return(new ModalDialogFormJsonResult()); }
private PartialViewResult ViewEditNote(EditGrantNoteViewModel viewModel, EditGrantNoteType editGrantNoteType) { var viewData = new EditGrantNoteViewData(editGrantNoteType); return(RazorPartialView <EditGrantNote, EditGrantNoteViewData, EditGrantNoteViewModel>(viewData, viewModel)); }
public PartialViewResult NewGrantNote(GrantPrimaryKey grantPrimaryKey) { var viewModel = new EditGrantNoteViewModel(); return(ViewEditNote(viewModel, EditGrantNoteType.NewNote)); }