示例#1
0
        public ActionResult Edit(int studentId)
        {
            //look up a student in the db
            Student student = studentsRepository.Find(studentId);

            return(View(student));
        }
        // GET: Students/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var student = await _studentsRepository.Find(id.Value);

            if (student == null)
            {
                return(NotFound());
            }

            return(View(student));
        }
示例#3
0
        public IActionResult Index(string q)
        {
            if (string.IsNullOrWhiteSpace(q))
            {
                return(View());
            }

            var users = _usersRepository.Find(q);

            return(View(users));
        }
 /// <summary>
 /// Validates whether student is valid or not
 /// </summary>
 /// <param name="studentId">student Id</param>
 /// <returns>Returns true if student is found in repostiory, else false</returns>
 public bool IsValidStudent(int studentId)
 {
     return(_studentsRepostiory.Find(studentId) != null);
 }