Пример #1
0
        public async Task <IActionResult> getLoanBooks()
        {
            try {
                var  username = User.FindFirst(ClaimTypes.NameIdentifier).Value;
                User user     = await _userRepository.FindByUsername(username);

                if (user == null)
                {
                    return(NotFound(new Respone(404, "Not Found", null)));
                }

                return(Ok(new Respone(200, "ok", await _borrowRepository.GetLoanBooks(user.user_id))));
            } catch (Exception e) {
                Console.WriteLine(e.Message);
                return(BadRequest(new Respone(400, "Failed", null)));
            }
        }