Пример #1
0
        public IActionResult Result(Resultclass model)
        {
            if (HttpContext.Session.GetString("UserName") != null)
            {
                var list1 = _context.registration.Where(s => s.Class == model.Class).ToList();

                return(View("ResultList", list1));
            }
            else
            {
                return(RedirectToAction("Login", "Home"));
            }
        }
Пример #2
0
        //Making a sample list from the data given above
        public void makeasamplelist()
        {
            for (int i = 0; i < 6; i++)
            {
                //Create a new instace of the class
                Resultclass obj = new Resultclass();

                //Add the sample data
                obj.name = arrayofnames[i];
                obj.marks = arrayofmarks[i];

                //Add the the item object into the listbox
                mylistbox.Items.Add(obj);
            }
        }
Пример #3
0
        public void secondmethod()
        {
            for (int i = 0; i < 8; i++)
            {
                //Create a new object of Result class
                Resultclass obj = new Resultclass();

                //add the corresponding data from the sample array
                obj.name = studentnames[i];
                obj.marks = studentmarks[i];

                //add the object directly into the list box
                mylistbox.Items.Add(obj);               

            }
        }
Пример #4
0
        public void firstmethod()
        {
            //create a list of Resultclass
            List<Resultclass> mylist = new List<Resultclass>();

            for (int i = 0; i < 8; i++)
            {
                //Create a new object of Result class
                Resultclass obj = new Resultclass();
                
                //add the corresponding data from the sample array
                obj.name = studentnames[i];
                obj.marks = studentmarks[i];

                //add the object into the list created
                mylist.Add(obj);

            }

            //Set the itemsource of the mylistbox created
            mylistbox.ItemsSource = mylist;
        }