Beispiel #1
0
        public async Task <IActionResult> DeleteStudentSubmit(int studentId)
        {
            var user = await GetCurrentUserAsync();

            if (user is ParentAccount parent)
            {
                var pStudents = _students.GetForParent(parent.Id);
                var student   = _students.GetById(studentId);

                if (pStudents.Contains(student))
                {
                    _students.Deactivate(studentId);
                    return(RedirectToAction("Index"));
                }
            }

            return(RedirectToAction("Error", "Home"));
        }