示例#1
0
        public void UpdateCategory(Category c)
        {
            CategoryC inter = new CategoryC();

            inter.DeleteCategory(c.id);
            inter.InsertCategory(c);
        }
示例#2
0
        public ActionResult Index()
        {
            var model = new CategoryC {
                ParentId = db.AllList().Where(x => x.ParentId == null).OrderBy(x => x.Order)
            };

            return(View(model));
        }
示例#3
0
        public List <string> CategorySource()
        {
            CategoryC     cat = new CategoryC();
            List <string> l   = cat.AllCategories();

            l.Add("All");
            return(l);
        }
示例#4
0
        public List <string> MainCatSource()
        {
            CategoryC     i = new CategoryC();
            List <string> l = i.AllMainC();

            l.Add("New");
            return(l);
        }
示例#5
0
        static void Main(string[] args)
        {
            CategoryC c = new CategoryC();

            foreach (var v in c.CategoryList())
            {
                Console.WriteLine(v.id);
            }
        }
示例#6
0
        public List <AdvertiseTileVM> GetAllAdvertises()
        {
            List <AdvertiseTileVM> adTileLst = new List <AdvertiseTileVM>();

            var results = (from ad in db.Advertise
                           join cat in db.Category on ad.CategoryId equals cat.CategoryId
                           join cc in db.CategoryCar on ad.AdvId equals cc.AdvId into CategoryC
                           from car in CategoryC.DefaultIfEmpty()
                           join f in db.Fuel on car.Fuel equals f.Id into fuelLeft
                           from tempFuel in fuelLeft.DefaultIfEmpty()
                           join cp in db.CategoryProperty on ad.AdvId equals cp.AdvId into categoryP
                           from cap in categoryP.DefaultIfEmpty()
                           join l in db.Location on ad.LocationId equals l.LocationId into locationLeft
                           from loc in locationLeft.DefaultIfEmpty()
                           join i in db.Images on ad.AdvId equals i.AdvId into imagesLeft
                           from img in imagesLeft.DefaultIfEmpty()
                           select new
            {
                ad.AdvId,
                Title = ad.Title,
                price = ad.Price,
                cat.CategoryId,
                car.Kmdriven,
                car.Year,
                img.ImageUrl,
                cap.Bathrooms,
                cap.Bedrooms,
                cap.BuiltupArea
            }
                           ).ToList();


            foreach (var ad in results)
            {
                adTileLst.Add(new AdvertiseTileVM
                {
                    AdvID     = ad.AdvId,
                    Price     = Convert.ToDouble(ad.price),
                    Title     = ad.Title,
                    TileLine1 = (ad.CategoryId == 1 ?
                                 (ad.Bedrooms + "-" + ad.Bathrooms + "-" + ad.BuiltupArea) :
                                 (ad.Year + "-" + ad.Kmdriven)),
                    ImageUrl = ad.ImageUrl
                });
            }
            return(adTileLst);
        }
示例#7
0
        public void CreateCategory(Category c)
        {
            if (c.name == "")
            {
                throw new Exception("The Category Name Is Empty");
            }
            if (c.mainC == "")
            {
                throw new Exception("The Main Category Is Empty");
            }

            CategoryC inter = new CategoryC();

            if (inter.searchIfEx(c.name, c.kind))
            {
                throw new Exception("This Category Already Exist");
            }
            inter.InsertCategory(c);
        }
示例#8
0
        public List <string> categoryDD()//all categories
        {
            CategoryC inter = new CategoryC();

            return(inter.AllCategories());
        }
示例#9
0
        public List <AdvertiseTileVM> SearchAdvertise(string SearchText)
        {
            List <AdvertiseTileVM> adTileLst = new List <AdvertiseTileVM>();

            var results = (from ad in db.Advertise
                           join cat in db.Category on ad.CategoryId equals cat.CategoryId
                           join cc in db.CategoryCar on ad.AdvId equals cc.AdvId into CategoryC
                           from car in CategoryC.DefaultIfEmpty()
                           join f in db.Fuel on car.Fuel equals f.Id into fuelLeft
                           from tempFuel in fuelLeft.DefaultIfEmpty()
                           join cp in db.CategoryProperty on ad.AdvId equals cp.AdvId into categoryP
                           from cap in categoryP.DefaultIfEmpty()
                           join l in db.Location on ad.LocationId equals l.LocationId into locationLeft
                           from loc in locationLeft.DefaultIfEmpty()
                           join i in db.Images on ad.AdvId equals i.AdvId into imagesLeft
                           from img in imagesLeft.DefaultIfEmpty()
                           where ad.Title.Contains(SearchText) ||
                           ad.Description.Contains(SearchText) ||
                           ad.Price.ToString().Contains(SearchText) ||
                           car.Brand.Contains(SearchText) ||
                           car.Description.Contains(SearchText) ||
                           tempFuel.Fuel1.Contains(SearchText) ||
                           car.Kmdriven.ToString().Contains(SearchText) ||
                           car.Year.ToString().Contains(SearchText) ||
                           cap.Type.Contains(SearchText)
                           select new
            {
                ad.AdvId,
                Title = ad.Title,
                price = ad.Price,
                cat.CategoryId,
                car.Kmdriven,
                car.Year,
                img.ImageUrl,
                cap.Bathrooms,
                cap.Bedrooms,
                cap.BuiltupArea
                //cap.CarParking,
                //cap.Construction,
                //cap.Furnishing,
                //cap.ListedBy,
                //cap.Maintenance,
                //cap.MealInclude,
                //cap.PropertyType,
                //cap.TotalFloors,
                //cap.Type,
                //cap.VastuCompliant,
            }
                           ).ToList();


            foreach (var ad in results)
            {
                adTileLst.Add(new AdvertiseTileVM
                {
                    AdvID     = ad.AdvId, Price = Convert.ToDouble(ad.price), Title = ad.Title,
                    TileLine1 = (ad.CategoryId == 1 ?
                                 (ad.Bedrooms + "-" + ad.Bathrooms + "-" + ad.BuiltupArea) :
                                 (ad.Year + "-" + ad.Kmdriven)),
                    ImageUrl = ad.ImageUrl
                });
            }

            return(adTileLst);
        }
示例#10
0
        public List <string> CategorySource(string kind)
        {
            CategoryC c = new CategoryC();

            return(c.AllCategoriesByKind(kind));
        }
示例#11
0
        public Category ReturnCategory(int Id)
        {
            CategoryC inter = new CategoryC();

            return(inter.returnCategory(Id));
        }
示例#12
0
        public List <CatWithMain> CategoryList()
        {
            CategoryC inter = new CategoryC();

            return(inter.CategoryList());
        }
示例#13
0
        public void DeleteCategory(int Id)
        {
            CategoryC inter = new CategoryC();

            inter.DeleteCategory(Id);
        }
示例#14
0
        public bool CheckIfAlreadyExist(Category c)
        {
            CategoryC inter = new CategoryC();

            return(inter.IsSameExist(c));
        }
示例#15
0
        public string findMainCatName(string cid)
        {
            CategoryC c = new CategoryC();

            return(c.findMainCName(Convert.ToInt32(cid)));
        }
示例#16
0
        string findCategoryName(string cid)
        {
            CategoryC c = new CategoryC();

            return(c.returnCategory(Convert.ToInt32(cid)).name);
        }