Example #1
0
 public Seeder(EFContext context, UsersEngine uEngine, ProductsEngine pEngine, OrdersEngine oEngine, IDataProtectionProvider protectionProvider)
 {
     this.context   = context;
     this.uEngine   = uEngine;
     this.pEngine   = pEngine;
     this.oEngine   = oEngine;
     this.protector = protectionProvider.CreateProtector("luckyNumber7");
 }
        public UserManager()
        {
            _cartProductsByItemKey = new Dictionary <ItemKey, IEnumerable <Product> >();
            _priceCartByChains     = new Dictionary <Chain, double>();

            _users       = UsersEngine.Users;
            _currentUser = UsersEngine.GetGeustUser();

            RepositoryEngine.ChainsArchive
            .ToList()
            .ForEach(chainModel => _priceCartByChains[chainModel] = 0);
        }
Example #3
0
 public async Task <IResultEngine> Add(UsersEngine user)
 {
     try
     {
         if (user == null)
         {
             return(await Task.FromResult(ResultEngine.Fail("topic null")));
         }
         throw new NotImplementedException();
         //await _dbContext.AddAsync(user);
         //int result = await _dbContext.SaveChangesAsync(); ;
         //if (result >= 0)
         //    return await Task.FromResult(ResultEngine.Success());
         //else
         //    return await Task.FromResult(ResultEngine.Fail("Not add"));
     }
     catch (Exception ex)
     {
         return(await Task.FromResult(ResultEngine.Fail("Not add")));
     }
     //throw new NotImplementedException();
 }
Example #4
0
        public async Task <IResultEngine> Delete(UsersEngine user)
        {
            try
            {
                throw new NotImplementedException();
                //if (user == null)
                //    return await Task.FromResult(ResultEngine.Fail());
                //var dbUser = _dbContext.UsersEngine.FirstOrDefaultAsync(z => z.UserName == user.UserName).ResultEngine;
                //if (dbUser != null)
                //    return await Add(user);

                //_dbContext.Remove(dbUser);
                //int result = await _dbContext.SaveChangesAsync();
                //if (result >= 0)
                //    return await Task.FromResult(ResultEngine.Success());
                //else
                //    return await Task.FromResult(ResultEngine.Success("Not Delete"));
            }
            catch (Exception ex)
            {
                return(await Task.FromResult(ResultEngine.Fail("Not Delete")));
            }
        }
Example #5
0
 public OrdersController(EFContext context, OrdersEngine engine, UsersEngine uEngine, ProductsEngine pEngine)
 {
     this.engine  = engine;
     this.uEngine = uEngine;
     this.pEngine = pEngine;
 }
Example #6
0
 public UserController(UsersEngine engine, UserManager <User> userManager, IOptions <AppSettings> appSettings)
 {
     this.engine      = engine;
     this.userManager = userManager;
     this.appSettings = appSettings.Value;
 }
Example #7
0
 public ProductsController(ProductsEngine engine, UsersEngine uEngine)
 {
     this.engine  = engine;
     this.uEngine = uEngine;
 }