public async Task <Models.SimpleInvoice.Tax> CancelTaxChanges(Models.SimpleInvoice.Tax item) { var entityToCancel = Context.Entry(item); entityToCancel.CurrentValues.SetValues(entityToCancel.OriginalValues); entityToCancel.State = EntityState.Unchanged; return(item); }
public async Task <Models.SimpleInvoice.Tax> CreateTax(Models.SimpleInvoice.Tax tax) { OnTaxCreated(tax); Context.Taxes.Add(tax); Context.SaveChanges(); OnAfterTaxCreated(tax); return(tax); }
protected async System.Threading.Tasks.Task Form0Submit(SimpleInvoiceManagementSoftware.Models.SimpleInvoice.Tax args) { try { var simpleInvoiceUpdateTaxResult = await SimpleInvoice.UpdateTax(TaxId, tax); DialogService.Close(tax); } catch (System.Exception simpleInvoiceUpdateTaxException) { NotificationService.Notify(new NotificationMessage() { Severity = NotificationSeverity.Error, Summary = $"Error", Detail = $"Unable to update Tax" }); } }
public void DataInitialization() { var company = Context.Companies.FirstOrDefault(); if (company == null) { company = new Models.SimpleInvoice.Company(); company.Name = "YourCompany, Inc."; company.Description = "My next great company."; company.Address = "1st Pajajaran Street."; company.City = "Bandung City."; Context.Companies.Add(company); var customer = new Models.SimpleInvoice.Customer(); customer.Name = "Default Customer"; customer.Description = "My best loyal customer"; customer.Address = "1st Sudirman Street."; customer.City = "Jakarta City."; Context.Customers.Add(customer); var officeBasic = new Models.SimpleInvoice.Product(); officeBasic.Name = "Basic, MS Office 365."; officeBasic.UnitPrice = 50; var officeStandard = new Models.SimpleInvoice.Product(); officeStandard.Name = "Standard, MS Office 365."; officeStandard.UnitPrice = 100; var officePremium = new Models.SimpleInvoice.Product(); officePremium.Name = "Premium, MS Office 365."; officePremium.UnitPrice = 200; Context.Products.AddRange(officeBasic, officeStandard, officePremium); var tax = new Models.SimpleInvoice.Tax(); tax.Name = "VAT"; tax.TaxTariffPercentage = 10; Context.Taxes.Add(tax); Context.SaveChanges(); } }
public async Task <Models.SimpleInvoice.Tax> UpdateTax(int?taxId, Models.SimpleInvoice.Tax tax) { OnTaxUpdated(tax); var itemToUpdate = Context.Taxes .Where(i => i.TaxId == taxId) .FirstOrDefault(); if (itemToUpdate == null) { throw new Exception("Item no longer available"); } var entryToUpdate = Context.Entry(itemToUpdate); entryToUpdate.CurrentValues.SetValues(tax); entryToUpdate.State = EntityState.Modified; Context.SaveChanges(); OnAfterTaxUpdated(tax); return(tax); }
partial void OnAfterTaxUpdated(Models.SimpleInvoice.Tax item);
partial void OnTaxGet(Models.SimpleInvoice.Tax item);
partial void OnTaxDeleted(Models.SimpleInvoice.Tax item);
partial void OnTaxCreated(Models.SimpleInvoice.Tax item);
protected async System.Threading.Tasks.Task Load() { var simpleInvoiceGetTaxByTaxIdResult = await SimpleInvoice.GetTaxByTaxId(TaxId); tax = simpleInvoiceGetTaxByTaxIdResult; }
protected async System.Threading.Tasks.Task Grid0RowSelect(SimpleInvoiceManagementSoftware.Models.SimpleInvoice.Tax args) { var dialogResult = await DialogService.OpenAsync <EditTax>("Edit Tax", new Dictionary <string, object>() { { "TaxId", args.TaxId } }); await InvokeAsync(() => { StateHasChanged(); }); }
protected async System.Threading.Tasks.Task Load() { tax = new SimpleInvoiceManagementSoftware.Models.SimpleInvoice.Tax() { }; }