public PartialViewResult NewInvoiceLineItem(InvoicePrimaryKey invoicePrimaryKey) { var invoiceID = invoicePrimaryKey.EntityObject.InvoiceID; var viewModel = new EditInvoiceLineItemViewModel(invoiceID); return(ViewEditInvoiceLineItem(viewModel)); }
public PartialViewResult EditInvoiceLineItem(InvoiceLineItemPrimaryKey invoiceLineItemPrimaryKey) { var invoiceLineItem = invoiceLineItemPrimaryKey.EntityObject; var viewModel = new EditInvoiceLineItemViewModel(invoiceLineItem); return(ViewEditInvoiceLineItem(viewModel)); }
private PartialViewResult ViewEditInvoiceLineItem(EditInvoiceLineItemViewModel viewModel) { var costTypes = CostType.All.Where(x => x.IsValidInvoiceLineItemCostType).ToList(); var grantAllocations = HttpRequestStorage.DatabaseEntities.GrantAllocations.ToList(); var viewData = new EditInvoiceLineItemViewData(grantAllocations, costTypes); return(RazorPartialView <EditInvoiceLineItem, EditInvoiceLineItemViewData, EditInvoiceLineItemViewModel>(viewData, viewModel)); }
public ActionResult NewInvoiceLineItem(InvoicePrimaryKey invoicePrimaryKey, EditInvoiceLineItemViewModel viewModel) { var invoiceID = invoicePrimaryKey.EntityObject.InvoiceID; if (!ModelState.IsValid) { return(ViewEditInvoiceLineItem(viewModel)); } var invoiceLineItem = new InvoiceLineItem(invoiceID, viewModel.GrantAllocationID, viewModel.CostTypeID, viewModel.InvoiceLineItemAmount); viewModel.UpdateModel(invoiceLineItem); HttpRequestStorage.DatabaseEntities.InvoiceLineItems.Add(invoiceLineItem); HttpRequestStorage.DatabaseEntities.SaveChanges(); SetMessageForDisplay($"Invoice Line Item successfully added to this {FieldDefinition.Invoice.GetFieldDefinitionLabel()}."); return(new ModalDialogFormJsonResult()); }
public ActionResult EditInvoiceLineItem(InvoiceLineItemPrimaryKey invoiceLineItemPrimaryKey, EditInvoiceLineItemViewModel viewModel) { var invoiceLineItem = invoiceLineItemPrimaryKey.EntityObject; if (!ModelState.IsValid) { return(ViewEditInvoiceLineItem(viewModel)); } viewModel.UpdateModel(invoiceLineItem); return(new ModalDialogFormJsonResult()); }