public void UpdateCategory(Category c) { CategoryC inter = new CategoryC(); inter.DeleteCategory(c.id); inter.InsertCategory(c); }
public ActionResult Index() { var model = new CategoryC { ParentId = db.AllList().Where(x => x.ParentId == null).OrderBy(x => x.Order) }; return(View(model)); }
public List <string> CategorySource() { CategoryC cat = new CategoryC(); List <string> l = cat.AllCategories(); l.Add("All"); return(l); }
public List <string> MainCatSource() { CategoryC i = new CategoryC(); List <string> l = i.AllMainC(); l.Add("New"); return(l); }
static void Main(string[] args) { CategoryC c = new CategoryC(); foreach (var v in c.CategoryList()) { Console.WriteLine(v.id); } }
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); }
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); }
public List <string> categoryDD()//all categories { CategoryC inter = new CategoryC(); return(inter.AllCategories()); }
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); }
public List <string> CategorySource(string kind) { CategoryC c = new CategoryC(); return(c.AllCategoriesByKind(kind)); }
public Category ReturnCategory(int Id) { CategoryC inter = new CategoryC(); return(inter.returnCategory(Id)); }
public List <CatWithMain> CategoryList() { CategoryC inter = new CategoryC(); return(inter.CategoryList()); }
public void DeleteCategory(int Id) { CategoryC inter = new CategoryC(); inter.DeleteCategory(Id); }
public bool CheckIfAlreadyExist(Category c) { CategoryC inter = new CategoryC(); return(inter.IsSameExist(c)); }
public string findMainCatName(string cid) { CategoryC c = new CategoryC(); return(c.findMainCName(Convert.ToInt32(cid))); }
string findCategoryName(string cid) { CategoryC c = new CategoryC(); return(c.returnCategory(Convert.ToInt32(cid)).name); }