コード例 #1
0
 public DashboardController(UserManager <User> userManager, EatContext appDbContext,
                            IHttpContextAccessor httpContextAccessor, IStringLocalizer localizer)
 {
     _caller       = httpContextAccessor.HttpContext.User;
     _appDbContext = appDbContext;
     _localizer    = localizer;
 }
コード例 #2
0
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;

            using (var context = new EatContext())
            {
                context.Database.EnsureCreated();
            }
        }
コード例 #3
0
        private IStringLocalizer CreateStringLocalizer()
        {
            EatContext _db = new EatContext(
                new DbContextOptionsBuilder <EatContext>()
                .UseSqlServer(_connectionString)
                .Options);

            // инициализация базы данных
            if (!_db.Cultures.Any())
            {
                _db.AddRange(
                    new Culture
                {
                    Name      = "en",
                    Resources = new List <Resource>()
                    {
                        new Resource {
                            Key = "Header", Value = "Hello"
                        },
                        new Resource {
                            Key = "Message", Value = "Welcome"
                        }
                    }
                },
                    new Culture
                {
                    Name      = "ru",
                    Resources = new List <Resource>()
                    {
                        new Resource {
                            Key = "Header", Value = "Привет"
                        },
                        new Resource {
                            Key = "Message", Value = "Добро пожаловать"
                        }
                    }
                },
                    new Culture
                {
                    Name      = "uk",
                    Resources = new List <Resource>()
                    {
                        new Resource {
                            Key = "Header", Value = "Привіт"
                        },
                        new Resource {
                            Key = "Message", Value = "Ласкаво просимо"
                        }
                    }
                }
                    );
                _db.SaveChanges();
            }
            return(new EFStringLocalizer(_db));
        }
コード例 #4
0
 public CartRepository()
 {
     this.db = new EatContext();
 }
コード例 #5
0
 public CustomerRepository()
 {
     this.db = new EatContext();
 }
コード例 #6
0
 public IngredientRepository()
 {
     this.db = new EatContext();
 }
コード例 #7
0
 public FavouriteDishRepository()
 {
     this.db = new EatContext();
 }
コード例 #8
0
 public ProductRepository()
 {
     this.db = new EatContext();
 }
コード例 #9
0
 public MealTimeRepository()
 {
     this.db = new EatContext();
 }
コード例 #10
0
 public EFStringLocalizer(EatContext db)
 {
     _db = db;
 }
コード例 #11
0
 public MenuRepository()
 {
     this.db = new EatContext();
 }
コード例 #12
0
 public BoxMigrationRepository()
 {
     this.db = new EatContext();
 }
コード例 #13
0
 public DishRepository()
 {
     this.db = new EatContext();
 }
コード例 #14
0
 public AccountController(UserManager <User> userManager, IMapper mapper, EatContext appDbContext)
 {
     _userManager  = userManager;
     _mapper       = mapper;
     _appDbContext = appDbContext;
 }
コード例 #15
0
 public DeliveryAddressRepository()
 {
     this.db = new EatContext();
 }
コード例 #16
0
 public FoodStyleProductRepository()
 {
     this.db = new EatContext();
 }
コード例 #17
0
 public FoodOrderRepository()
 {
     this.db = new EatContext();
 }
コード例 #18
0
 public RestaurantRepository()
 {
     this.db = new EatContext();
 }