Пример #1
0
        public IActionResult Get(string userId)

        {
            try
            {
                // Get history of user

                var deviceBorrows = _borrowRepository.GetDeviceBorrowsBy(userId);

                var deviceBorrowViewModels = _mapper.Map <List <DeviceBorrowViewModel> >(deviceBorrows);
                return(Ok(new { UserName = User.Identity.Name, Total = deviceBorrowViewModels.Count, Items = deviceBorrowViewModels }));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }