public static async Task SeedAsync(FoodDeliveryContext foodContext) { foodContext.Database.Migrate(); if (!foodContext.CategoryTypes.Any()) { foodContext.CategoryTypes.AddRange( GetCategoryTypes()); await foodContext.SaveChangesAsync(); } if (!foodContext.CategoryItems.Any()) { foodContext.CategoryItems.AddRange( GetItems()); await foodContext.SaveChangesAsync(); } if (!foodContext.Users.Any()) { //AddDefaultUser(); } }
public AccountsController(UserManager <User> userManager, SignInManager <User> signInManager, FoodDeliveryContext dbContext, IConfiguration configuration) { _userManager = userManager; _signInManager = signInManager; _dbContext = dbContext; _configuration = configuration; }
public CartService(FoodDeliveryContext db, IProductsService productService, IUserService userService) { this._db = db; this._productService = productService; this._userService = userService; }
public OrdersController(UserManager <User> userManager, SignInManager <User> signInManager, FoodDeliveryContext dbContext, IConfiguration configuration, IMapper mapper) { _userManager = userManager; _signInManager = signInManager; _dbContext = dbContext; _configuration = configuration; _mapper = mapper; }
public UnitOfWork(FoodDeliveryContext context) { _context = context; Dishes = new BaseRepository <Dish>(_context); FoodCategories = new BaseRepository <FoodCategory>(_context); Menus = new MenuRepository(_context); MenuCategories = new BaseRepository <MenuCategory>(_context); Orders = new BaseRepository <Order>(_context); Restaurants = new RestaurantRepository(_context); Scores = new BaseRepository <Score>(_context); Users = new BaseRepository <User>(_context); }
public static void ConfigureAuth(IAppBuilder app , string connectionString , string publicClientId , OAuthAuthorizationServerOptions OAuthOptions) { // Configure the db context and user manager to use a single instance per request app.CreatePerOwinContext(() => FoodDeliveryContext.Create(connectionString)); app.CreatePerOwinContext <ApplicationUserManager>(ApplicationUserManager.Create); // Enable the application to use a cookie to store information for the signed in user // and to use a cookie to temporarily store information about a user logging in with a third party login provider app.UseCookieAuthentication(new CookieAuthenticationOptions()); app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie); // Configure the application for OAuth based flow publicClientId = "self"; OAuthOptions = new OAuthAuthorizationServerOptions { TokenEndpointPath = new PathString("/Token"), Provider = new ApplicationOAuthProvider(publicClientId), AuthorizeEndpointPath = new PathString("/api/Account/ExternalLogin"), AccessTokenExpireTimeSpan = TimeSpan.FromDays(14), // In production mode set AllowInsecureHttp = false AllowInsecureHttp = true }; // Enable the application to use bearer tokens to authenticate users app.UseOAuthBearerTokens(OAuthOptions); // Uncomment the following lines to enable logging in with third party login providers //app.UseMicrosoftAccountAuthentication( // clientId: "", // clientSecret: ""); //app.UseTwitterAuthentication( // consumerKey: "", // consumerSecret: ""); //app.UseFacebookAuthentication( // appId: "", // appSecret: ""); //app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions() //{ // ClientId = "", // ClientSecret = "" //}); }
public static void Initialize(FoodDeliveryContext context) { context.Database.EnsureCreated(); if (context.Customers.Any()) { return; } var customers = new [] { new Customer { FirstName = "Artur", LastName = "Bilzaryan", Email = "*****@*****.**", PhoneNumber = "+170070000" } }; foreach (var customer in customers) { context.Customers.Add(customer); } context.SaveChanges(); }
public DrinksController(IHostingEnvironment env, IMapper mapper, FoodDeliveryContext dbContext) { _hostingEnv = env; this._mapper = mapper; _dbContext = dbContext; }
public OrdersService(IUserService userService, ICartService shoppingCartService, FoodDeliveryContext db) { this._userService = userService; this._cartService = shoppingCartService; this._db = db; }
public UserService(FoodDeliveryContext db, UserManager <FoodDeliveryUser> userManager) { this._userManager = userManager; this._db = db; }
public CustomersController(FoodDeliveryContext context) { _context = context; }
public CustomerController(FoodDeliveryContext context) { this.context = context; }
public GenericRepository() { Context = new FoodDeliveryContext(); _dbSet = Context.Set <TEnity>(); }
public RestaurantsService(FoodDeliveryContext context) { this.db = context; }
public IngradientsController(IHostingEnvironment env, FoodDeliveryContext dbContext) { _hostingEnv = env; _dbContext = dbContext; }
public OrderService(FoodDeliveryContext context) { this.db = context; }