Example #1
0
        public IActionResult DisplayUserHistory(string userName)
        {
            // Assume the user is not authorized
            IActionResult result = Unauthorized();

            try
            {
                var user    = _db.GetUserItemByLogin(userName);
                var history = _db.GetUserHistory(user);

                result = Ok(history);
            }
            catch (Exception)
            {
                result = BadRequest(new { Message = "Get history for user failed." });
            }
            return(result);
        }