コード例 #1
0
        public IActionResult DisplayEquipment()
        {
            // Assume the user is not authorized
            IActionResult result = Unauthorized();

            try
            {
                var workout = _db.GetEquipment();
                var myDTOs  = workout.Select(x => MapToDTO(x)).ToArray();
                result = Ok(myDTOs);
            }
            catch (Exception)
            {
                result = BadRequest(new { Message = "Get workout failed." });
            }
            return(result);
        }