Example #1
0
        // GET: Car/Create
        public ActionResult Create()
        {
            var res  = serviceCarModel.GetMany().ToList();
            var sub  = serviceSubCategory.GetMany().ToList();
            var year = serviceCreation.GetMany().ToList();
            var type = serviceType.GetMany().ToList();

            ViewBag.TypeId         = new SelectList(type, "TypeId", "Name");
            ViewBag.CreationYearId = new SelectList(year, "CreationYearId", "Name");
            ViewBag.SubCategoryId  = new SelectList(sub, "SubCategoryId", "Name");
            ViewBag.CarModelId     = new SelectList(res, "CarModelId", "Name");
            return(View());
        }
        // GET: Admin/SubCategory
        public ActionResult Index()
        {
            var res = myService.GetMany();
            List <SubCategoryViewModel> liste = new List <SubCategoryViewModel>();

            foreach (var item in res)
            {
                liste.Add(
                    new SubCategoryViewModel
                {
                    SubCategoryID = item.SubCategoryID,
                    Name          = item.Name,
                    Picture       = item.Picture,
                    Subscription  = item.Subscription,
                    Active        = item.Active,
                    CategoryName  = myServicecat.GetById(item.CategoryId).Name
                });
            }

            return(View(liste));
        }
Example #3
0
        public ActionResult subs(int id)
        {
            var res = serviceSubCategory.GetMany().Where(x => x.CategoryId == id).ToList();

            return(View(res));
        }