public async Task <Models.SimpleInvoice.Customer> CancelCustomerChanges(Models.SimpleInvoice.Customer item) { var entityToCancel = Context.Entry(item); entityToCancel.CurrentValues.SetValues(entityToCancel.OriginalValues); entityToCancel.State = EntityState.Unchanged; return(item); }
public async Task <Models.SimpleInvoice.Customer> CreateCustomer(Models.SimpleInvoice.Customer customer) { OnCustomerCreated(customer); Context.Customers.Add(customer); Context.SaveChanges(); OnAfterCustomerCreated(customer); return(customer); }
protected async System.Threading.Tasks.Task Form0Submit(SimpleInvoiceManagementSoftware.Models.SimpleInvoice.Customer args) { try { var simpleInvoiceUpdateCustomerResult = await SimpleInvoice.UpdateCustomer(CustomerId, customer); DialogService.Close(customer); } catch (System.Exception simpleInvoiceUpdateCustomerException) { NotificationService.Notify(new NotificationMessage() { Severity = NotificationSeverity.Error, Summary = $"Error", Detail = $"Unable to update Customer" }); } }
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(); } }
protected async System.Threading.Tasks.Task Grid0RowSelect(SimpleInvoiceManagementSoftware.Models.SimpleInvoice.Customer args) { var dialogResult = await DialogService.OpenAsync <EditCustomer>("Edit Customer", new Dictionary <string, object>() { { "CustomerId", args.CustomerId } }); await InvokeAsync(() => { StateHasChanged(); }); }
protected async System.Threading.Tasks.Task Load() { var simpleInvoiceGetCustomerByCustomerIdResult = await SimpleInvoice.GetCustomerByCustomerId(CustomerId); customer = simpleInvoiceGetCustomerByCustomerIdResult; }
public async Task <Models.SimpleInvoice.Customer> UpdateCustomer(int?customerId, Models.SimpleInvoice.Customer customer) { OnCustomerUpdated(customer); var itemToUpdate = Context.Customers .Where(i => i.CustomerId == customerId) .FirstOrDefault(); if (itemToUpdate == null) { throw new Exception("Item no longer available"); } var entryToUpdate = Context.Entry(itemToUpdate); entryToUpdate.CurrentValues.SetValues(customer); entryToUpdate.State = EntityState.Modified; Context.SaveChanges(); OnAfterCustomerUpdated(customer); return(customer); }
partial void OnAfterCustomerUpdated(Models.SimpleInvoice.Customer item);
partial void OnCustomerGet(Models.SimpleInvoice.Customer item);
partial void OnCustomerDeleted(Models.SimpleInvoice.Customer item);
protected async System.Threading.Tasks.Task Load() { customer = new SimpleInvoiceManagementSoftware.Models.SimpleInvoice.Customer() { }; }