public List <Business> GetBusinessList() { using (var context = new InoxicoHPContext(options.Options)) { return(context.Business.ToList()); } }
public void AddCustomer(Customer customer) { using (var context = new InoxicoHPContext(options.Options)) { context.Add(customer); context.SaveChanges(); } }
public void CustomerPaymentReceived(string paymentID) { using (var context = new InoxicoHPContext(options.Options)) { var customer = context.Customer.FirstOrDefault(cst => cst.PaymentID == paymentID); customer.PaymentReceived = true; context.Update(customer); context.SaveChanges(); } }
public BusinessInox GetBusinessInoxById(string?businessInoxId) { if (businessInoxId == null) { return(null); } using (var context = new InoxicoHPContext(options.Options)) { var businessIx = context.BusinessInox.FirstOrDefault(bsnIx => bsnIx.NoxID == businessInoxId); return(businessIx); } }
public Business GetBusinessById(int?businessId) { if (businessId == null) { return(null); } using (var context = new InoxicoHPContext(options.Options)) { var business = context.Business.FirstOrDefault(bsn => bsn.Id == businessId); return(business); } }
public string GenerateCustomerPaymentID(int customerID) { using (var context = new InoxicoHPContext(options.Options)) { var customer = context.Customer.FirstOrDefault(cst => cst.Id == customerID); if (customer == null) { return(""); } const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; string paymentID = new string(Enumerable.Repeat(chars, 32) .Select(s => s[random.Next(s.Length)]).ToArray()); customer.PaymentID = paymentID; context.Update(customer); context.SaveChanges(); return(paymentID); } }