Пример #1
0
        public async Task Update(int id, UpdateStudentDto student)
        {
            var stud = _studentRepository
                       .All()
                       .Include(x => x.StudentCareers)
                       .FirstOrDefault(x => x.Id == id);

            if (stud.Email != student.Email)
            {
                var studentBot = await _dataBotRepository.FirstOrDefault(x => x.Student.Id == id);

                if (studentBot != null)
                {
                    await _dataBotRepository.Delete(studentBot);
                }
            }
            stud.Account       = student.Account;
            stud.FirstName     = student.FirstName;
            stud.SecondName    = student.SecondName;
            stud.FirstSurname  = student.FirstSurname;
            stud.SecondSurname = student.SecondSurname;
            stud.Settlement    = student.Settlement;
            stud.Email         = student.Email;

            await _studentRepository.Update(stud.StudentCareers, @student.Careers
                                            .Select(x => new StudentCareer()
            {
                CareerId  = x,
                StudentId = id
            }), x => x.CareerId);
        }
 public ActionResult <List <Student> > GetApplicant()
 {
     try
     {
         var student = _studentRepo.All();
         return(Ok(student));
     }
     catch (Exception ex)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, "Internal Server Error"));
     }
 }
Пример #3
0
        public async Task <IActionResult> All()
        {
            try
            {
                var students = await _repository.All();

                return(Ok(students));
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #4
0
 public List <Student> GetStudenten()
 {
     return(studentRepository.All().ToList <Student>());
 }
Пример #5
0
 public List <Student> All()
 {
     return(_studentRepository.All());
 }
Пример #6
0
 public List <Student> GetSQLStudents()
 {
     return(_studentRepository.All().ToList());
 }