コード例 #1
0
 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;
     }
 }
コード例 #2
0
        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;
            }
        }