public async Task <Customer> GetCustomer(string userId) { try { AppContextFactory factory = new AppContextFactory(); using (ApplicationDbContext context = factory.CreateDbContext(null)) { return(await context.Customers.Include(c => c.Identity).SingleAsync(c => c.Identity.Id == Convert.ToString(userId))); } } catch { throw; } }
public async Task <int> RegisterCustomer(Customer user) { try { AppContextFactory factory = new AppContextFactory(); using (ApplicationDbContext context = factory.CreateDbContext(null)) { await context.Customers.AddAsync(user); return(await context.SaveChangesAsync()); } } catch { throw; } }