Esempio n. 1
0
 /// <summary>
 ///دریافت منو فوتر
 /// </summary>
 /// <returns></returns>
 public bool SubscribeByEmail(string email)
 {
     using (Store.Models.DataBase.Context.StoreContext _Storedb = new DataBase.Context.StoreContext(null))
     {
         try
         {
             var result = _Storedb.NewsLetters.Where(x => x.Email == email);
             if (result.Count() > 0)
             {
                 result.First().IsDeleted = false;
                 result.First().Token     = string.Empty.GetNewToken();
             }
             else
             {
                 _Storedb.NewsLetters.Add(new DataBase.Entities.NewsLetter()
                 {
                     Email     = email,
                     IsDeleted = false,
                     Token     = string.Empty.GetNewToken()
                 });
             }
             _Storedb.SaveChanges();
             return(true);
         }
         catch (Exception)
         {
             return(false);
         }
     }
 }
Esempio n. 2
0
 /// <summary>
 ///  عضویت در خبرنامه
 /// </summary>
 /// <param name="email">ایمیل</param>
 /// <returns></returns>
 public FoterBarMenu GetFooterMenu()
 {
     using (Store.Models.DataBase.Context.StoreContext _Storedb = new DataBase.Context.StoreContext(null))
     {
         return(JsonConvert.DeserializeObject <FoterBarMenu>(_Storedb.Settings.First().ContactUs_Json));
     }
 }
Esempio n. 3
0
 public Banner GetBanner()
 {
     using (Store.Models.DataBase.Context.StoreContext _Storedb = new DataBase.Context.StoreContext(null))
     {
         return(_Storedb.Settings.Select(x => new Banner
         {
             ImageName = x.BanerImageName,
             ImageNameMob = x.BanerImageNameMob
         }).First());
     }
 }
Esempio n. 4
0
 public List <Slider> GetSlider()
 {
     using (Store.Models.DataBase.Context.StoreContext _Storedb = new DataBase.Context.StoreContext(null))
     {
         return(_Storedb.Sliders.Where(x => x.IsActive).Select(x => new Slider {
             Description = x.Description,
             ImageName = x.ImageName,
             ImageNameMob = x.ImageNameMob,
             IsShowInMainPage = x.IsShowInMainPage,
             SliderId = x.SliderId,
             Title = x.Title,
             UrlLink = x.UrlLink,
             UrlText = x.UrlText
         }).ToList());
     }
 }
Esempio n. 5
0
 public List <Product> GetProductsBySearch(string search_text)
 {
     using (Store.Models.DataBase.Context.StoreContext _Storedb = new DataBase.Context.StoreContext(null))
     {
         return(_Storedb.Products.Where(x => x.Name.Contains(search_text) || x.EName.Contains(search_text)).Select(x => new Product
         {
             ProductId = x.ProductId,
             Ename = x.EName,
             ImageName = JsonConvert.DeserializeObject <List <ImageProduct> >(x.Images_Json).Where(p => p.IsDefaultImage == true).First().EName,
             IsExist = x.ExistCount > 0 ? true : false,
             IsSpecial = x.IsSpecial,
             Name = x.Name,
             Price_New = x.SalesPrice.ToPriceStringFormat(),
             Price_Old = x.WrittenPrice.ToPriceStringFormat(),
             UnitType = x.UnitType
         }).ToList());
     }
 }
Esempio n. 6
0
        public Category GetCategory()
        {
            using (Store.Models.DataBase.Context.StoreContext _Storedb = new DataBase.Context.StoreContext(null))
            {
                _Storedb.ChangeTracker.QueryTrackingBehavior = Microsoft.EntityFrameworkCore.QueryTrackingBehavior.NoTracking;

                var             categories      = _Storedb.Categories.Where(x => x.IsActive == true).OrderBy(x => x.OrderNumber).ToList();
                List <Category> categories_list = new List <Category>();
                foreach (var cat in categories)
                {
                    Category category = new Category()
                    {
                        CategoryId  = cat.CategoryId,
                        Description = cat.Description,
                        EName       = cat.EName,
                        //Icon=cat.Icon,
                        MainCategoryId = cat.MainCategoryId,
                        Name           = cat.Name
                    };
                }
                return(null);
            }
        }