public IActionResult GetAll(DateTime date) { // Assume the user is not authorized IActionResult result = Unauthorized(); try { var classes = _db.GetClassesByDate(date); var dtoArr = classes.Select(x => MapToDTO(x)).ToArray(); result = Ok(dtoArr); } catch (Exception) { result = BadRequest(new { Message = "Get all classes failed." }); } return(result); }