Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            StudentServices services = new StudentServices();

            services.Add(new Student
            {
                Name     = "Ivan",
                Age      = 20,
                Lastname = "Ivanov",
            });
            services.Add(new Student
            {
                Name     = "Petro",
                Age      = 22,
                Lastname = "Petrenko",
            });
            Random rand = new Random();

            foreach (Student item in services.Students)
            {
                item.AddMark("C++", rand.Next(1, 12));
                item.AddMark("C#", rand.Next(1, 12));
            }
            services.Save();
            foreach (Student item in services.Students)
            {
                Console.WriteLine(item);
            }
            Student best = services.FindBestStudent();

            Console.WriteLine($"Best student is {best}");
        }
Ejemplo n.º 2
0
        public ActionResult Add(AddViewModel avm)
        {
            //if (string.IsNullOrEmpty(avm.RollNumber) ||
            //    string.IsNullOrEmpty(avm.Name) ||
            //    string.IsNullOrEmpty(avm.CGPI) ||
            //    string.IsNullOrEmpty(avm.Location) ||
            //    string.IsNullOrEmpty(avm.DateOfBirth))
            //{
            //    return View(avm);
            //}

            studentService.Add(avm);
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 3
0
        public async Task <ActionResult <Student> > AddStudent([FromBody] Student student)
        {
            await studentServices.Add(student);

            return(student);
        }