Esempio n. 1
0
        public ActionResult DeleteStudent(string username)
        {
            StudentModel studentModel = new StudentModel();

            studentModel.Delete(username);
            return(RedirectToAction("ListStudents"));
        }
Esempio n. 2
0
 public IActionResult Delete(int id)
 {
     if (StudentModel.Delete(id))
     {
         return(Ok());
     }
     else
     {
         return(NotFound());
     }
 }
Esempio n. 3
0
        public int Delete()
        {
            int studentsDeleted = -1;

            try
            {
                studentsDeleted = _model.Delete(Id);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Problem in " + MethodBase.GetCurrentMethod().Name + ex.Message);
            }
            return(studentsDeleted);
        }
        public void DeleteStudent()
        {
            Console.Clear();
            Console.WriteLine("==============DELETE STUDENT================");
            Console.WriteLine("Enter id student you want delete.");
            var rollNumber = Console.ReadLine();
            var student    = _studentModel.FindById(rollNumber);

            if (student == null)
            {
                Console.WriteLine("Don't find id student. Please try again!");
                return;
            }

            Console.WriteLine($"Are you sure wanna delete student withh rollnumber{student.RollNumber} (y/n)");
            var choice = Console.ReadLine().ToLower();

            if (choice.Equals("n"))
            {
                return;
            }
            StudentModel.Delete(rollNumber);
        }
Esempio n. 5
0
        public void DeleteStudent()
        {
            Console.Clear();
            Console.WriteLine("==================REMOVE STUDENT=================");
            Console.WriteLine("Please enter student rollnumber to remove:");
            var rollNumber = Console.ReadLine();
            var student    = studentModel.FindById(rollNumber);

            if (student == null)
            {
                Console.WriteLine("Student is not found. Please try again.");
                return;
            }

            Console.WriteLine($"Are you sure wanna delete student with rollnumber {student.RollNumber} (y/n)");
            var choice = Console.ReadLine().ToLower();

            if (choice.Equals("n"))
            {
                return;
            }

            studentModel.Delete(rollNumber);
        }
Esempio n. 6
0
 public IActionResult Remove(int id)
 {
     StudentModel.Delete(id);
     return(RedirectToAction("ViewAll"));
 }