public ActionResult Index()
        {
            var result = catRepository.GetData();

            // return View that will display list of Categoeies
            return(View(result));
        }
Exemple #2
0
        // GET: Course

        public ActionResult Index()
        {
            var result       = corRepo.GetData();
            var studentidtmp = sturepo.GetData();
            var studidtmp    = studentidtmp.Where(s => s.Id == User.Identity.GetUserId()).FirstOrDefault().Id.ToString();

            ViewBag.Studid = studidtmp;
            return(View(result));
        }
        public ActionResult Index()
        {
            var result = corRepository.GetData();

            ViewBag.TrainerRowId = new SelectList(traRepository.GetData(), "TrainerRowId", "TrainerName");
            return(View(result));
        }
        /// <summary>
        /// The method that will used to respond the view
        /// for Accepting data for Product
        /// </summary>
        /// <returns></returns>
        public ActionResult Create()
        {
            // ViewBag is dynamic object thatb is used to pass additional data from
            // Action method to View
            ViewBag.Name        = "The View For Creating the New Product";
            ViewData["Message"] = "Makes Sure that all values you are passing are valid";

            var result = new Product();

            // List out all Categories and pass it to SelectList object of System.Web.Mvc
            // ViewBag.CategoryRowId, the CategoryRowId key is selected because, it is present into
            // Product class. So when the View is submitted, the CategoryRowId value will also be
            // submitted with Product class.
            //                                     Collection to be passed, Value that will be selected, value taht will be shown on UI
            ViewBag.CategoryRowId = new SelectList(catRepository.GetData(), "CategoryRowId", "SubCategoryName");

            // return a view that will show empty
            // Product information
            return(View(result));
        }
        // GET: Porduct


        // GET: Product
        /// <summary>
        /// Return List of Categories
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            List <Product> result = new List <Product>();

            // Read data from TempData
            // Check if the TempData has some values
            if (TempData.Keys.Count > 0)
            {
                // read data from, TempData
                int CatId = Convert.ToInt32(TempData["CategoryRowId"]);
                if (CatId > 0)
                {
                    // filter data based on CategoryRowId
                    result = (from prd in prdRespository.GetData()
                              where prd.CategoryRowId == CatId
                              select prd).ToList();
                    // Keep the data for Keys in TempData
                    TempData.Keep();

                    ViewBag.Message = $"List of Products for Category Row Id {CatId}";
                    if (result.Count == 0)
                    {
                        // there is no Product for the Category Row Id
                        ViewBag.Message = $"There are no Products for Category Row Id {CatId}";
                    }
                }
            }
            else
            {
                // read all products
                result          = prdRespository.GetData();
                ViewBag.Message = $"List of All Products";
            }


            // return View that will display list of Categoeies
            return(View(result));
        }
Exemple #6
0
        // GET: Module
        public ActionResult Index()
        {
            var result = modRepo.GetData();

            //Read data from TEMPDATA passed from courses action "Show Modules for Course":
            if (TempData["CourseRowId"] != null)
            {
                int corid = Convert.ToInt32(TempData["CourseRowId"]);
                result = (from mod in modRepo.GetData() where Convert.ToInt32(mod.CourseRowId) == corid select mod).ToList();
                //TempData.Keep();
                ViewBag.Message = $"Course of row id:{corid} Contains {result.Count} modules ";
                if (result.Count == 0)
                {
                    ViewBag.Message = $"This Course of row id:{corid} has no modules ";
                }
            }
            else
            {
                result          = modRepo.GetData();
                ViewBag.Message = "List of all modules ";
            }
            return(View(result));
        }
Exemple #7
0
        // GET: Trainer
        public ActionResult Index()
        {
            var result = trainRepo.GetData();

            return(View(result));
        }
Exemple #8
0
        /*public TrainerController(IBizRepository<Trainer, int> TrainerRepository)
         *  {
         *      this.TrainerRepository = TrainerRepository;
         *
         *  }*/



        public ActionResult Index()
        {
            var result = TrainerRepository.GetData();

            return(View(result));
        }
Exemple #9
0
 public ActionResult register()
 {
     ViewBag.StudentRowId = new SelectList(StudentRepository.GetData(), "StudentRowId", "StudentId");
     ViewBag.CourseRowId  = new SelectList(CourseRepository.GetData(), "CourseRowId", "CourseName");
     return(View());
 }
        // GET: SPA
        public ActionResult Index()
        {
            var cats = bizRepository.GetData();

            return(View(cats));
        }
 public ActionResult register()
 {
     ViewBag.StudentId   = new SelectList(catRepository.GetData(), "StudentKeyId", "StudentName");
     ViewBag.CourseKeyId = new SelectList(croRepository.GetData(), "CourseKeyId", "CourseName");
     return(View());
 }
        /*public TrainerController(IBizRepository<Trainer, int> TrainerRepository)
         *  {
         *      this.TrainerRepository = TrainerRepository;
         *
         *  }*/



        public ActionResult Index()
        {
            var result = StudentRepository.GetData();

            return(View(result));
        }
        /// <summary>
        /// http://localhost:<PORT>/api/CategoryAPI
        /// </summary>
        /// <returns></returns>
        public IHttpActionResult Get()
        {
            var result = catRepository.GetData();

            return(Ok(result));
        }