public IActionResult DisplayEquipmentHistory(int id) { // Assume the user is not authorized IActionResult result = Unauthorized(); try { EquipmentItem equip = _db.GetEquipmentById(id); IList <UsageItem> history = _db.GetEquipmentHistory(equip); result = Ok(history); } catch (Exception) { result = BadRequest(new { Message = "Get equipment history failed." }); } return(result); }
public IActionResult DisplayEquipmentById(int id) { // Assume the user is not authorized IActionResult result = Unauthorized(); try { var workout = _db.GetEquipmentById(id); EquipmentDTO equip = MapToDTO(workout); result = Ok(equip); } catch (Exception) { result = BadRequest(new { Message = "Get workout failed." }); } return(result); }