Exemple #1
0
        public ActionResult EditInvoiceLineItem(InvoiceLineItemPrimaryKey invoiceLineItemPrimaryKey, EditInvoiceLineItemViewModel viewModel)
        {
            var invoiceLineItem = invoiceLineItemPrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewEditInvoiceLineItem(viewModel));
            }
            viewModel.UpdateModel(invoiceLineItem);
            return(new ModalDialogFormJsonResult());
        }
Exemple #2
0
        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());
        }