public HttpResponseMessage All(int page, int count, string searchString) { try { var questions = questionLogic.All(page, count, searchString); int totalQuestions = questions.Count(); if (searchString == string.Empty || searchString == null) { totalQuestions = questionLogic.Count(); } HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, new { questions, totalQuestions }); return(response); } catch (Exception e) { HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.BadRequest, e.Message); return(response); } }