Beispiel #1
0
 public PeopleRepository(NetMarketDbContext netMarketDbContext, IMemoryCache cache)
 {
     _netMarketDbContext = netMarketDbContext;
     _actionsUpdate = new Dictionary<string, Func<string, object, string>>();
     _actionsUpdate.Add("login", LoginUpdate);
     _actionsUpdate.Add("email", EmailUpdate);
     _actionsUpdate.Add("password", PasswordUpdate);
     _actionsUpdate.Add("name", NameUpdate);
     _actionsUpdate.Add("surname", SurnameUpdate);
     _actionsUpdate.Add("middleName", MiddleNameUpdate);
     _actionsUpdate.Add("phoneNumber", PhoneNumberUpdate);
     _cache = cache;
 }
Beispiel #2
0
 public ProductRepository(NetMarketDbContext netMarketDbContext, IMemoryCache cache)
 {
     _netMarketDbContext = netMarketDbContext;
     _actionsUpdate      = new Dictionary <string, Func <Product, object, Product> >();
     _actionsUpdate.Add("company", CompanyUpdate);
     _actionsUpdate.Add("name", NameUpdate);
     _actionsUpdate.Add("price", PriceUpdate);
     _actionsUpdate.Add("storageCard", StorageCardUpdate);
     _actionsUpdate.Add("color", ColorUpdate);
     _actionsUpdate.Add("operationSystem", OperationSystemUpdate);
     _actionsUpdate.Add("weight", WeightUpdate);
     _actionsUpdate.Add("description", DescriptionUpdate);
     _actionsUpdate.Add("existence", ExistenceUpdate);
     _cache = cache;
 }
Beispiel #3
0
 public GenericRepository(NetMarketDbContext dbContext)
 {
     this._dbContext = dbContext;
 }
Beispiel #4
0
 public OrderRepository(NetMarketDbContext netMarketDbContext, IMemoryCache cache)
 {
     _netMarketDbContext = netMarketDbContext;
     _cache  = cache;
     _search = new SearchByOrderNumber();
 }
Beispiel #5
0
 public List <OrderViewModel> GetSearchData(object search, IMemoryCache cache, NetMarketDbContext netMarketDbContext)
 {
     if (cache.TryGetValue("allOrders", out List <OrderViewModel> list))
     {
         return((from order in list
                 where order.CustomerFullName.Contains((string)search)
                 select order).ToList());
     }
     return((from order in netMarketDbContext.Orders
             where order.Name.Contains((string)search) || order.Surname.Contains((string)search) || order.MiddleName != null && order.MiddleName.Contains((string)search)
             orderby order.Id descending
             select new OrderViewModel
     {
         OrderNumber = order.Id,
         CustomerFullName = order.MiddleName != null ? order.Surname + " " + order.Name + " " + order.MiddleName : order.Surname + " " + order.Name,
         Address = order.Address,
         OrderDate = order.OrderTime.ToShortDateString() + " в " + order.OrderTime.ToShortTimeString(),
         Sum = order.Sum,
         Status = (from st in netMarketDbContext.OrdersStatus
                   join ord in netMarketDbContext.Orders on st.Id equals ord.OrderStatusId
                   where st.Id == order.OrderStatusId
                   select st.Status).ToList()[0],
         Comment = order.Comment ?? "-",
         Email = order.Email,
         PhoneNumber = order.PhoneNumber,
         InformationForEmployee = order.UserId != null ? "Зарегистрированный пользователь" : "Связаться можно только через телефон или Email"
     }).ToList());
 }
Beispiel #6
0
 public ProductInBasketRepository(NetMarketDbContext netMarketDbContext, IMemoryCache cache)
 {
     _netMarketDbContext = netMarketDbContext;
     _cache = cache;
 }
Beispiel #7
0
 public ProductoRepository(NetMarketDbContext dbContext)
 {
     this._dbContext = dbContext;
 }