public async Task <ActionResult <IEnumerable <StudentViewModel> > > GetStudents(Guid specialtyId) { if (specialtyId.Equals(Guid.Empty)) { return(BadRequest("Id is empty")); } try { var students = await _specialtyService.GetStudentsAsync(specialtyId); var viewItem = _mapper.Map <IEnumerable <Dtos.Student>, IEnumerable <StudentViewModel> >(students); return(Ok(viewItem)); } catch (ServiceException ex) { return(StatusCode((int)ex.ErrorCode, ex.Message)); } catch (Exception ex) { await _logger.Error(ex.Message); return(StatusCode(500, "Something went wrong")); } }