public async Task <IActionResult> GetByPage(int PageNo) { try { var Page = await _diaryService.GetByPage(PageNo, this.UserId); if (Page != null) { DiaryResponseModel diariesResponse = _mapper.Map <DiaryResponseModel>(Page); if (diariesResponse != null) { return(Ok(new { status = HttpStatusCode.OK, valid = true, msg = "", response = diariesResponse })); } else { return(Ok(new { status = HttpStatusCode.InternalServerError, valid = false, msg = "No diaries with this page number", response = diariesResponse })); } } else { return(Ok(new { status = HttpStatusCode.InternalServerError, valid = false, msg = "No diaries created by you" })); } } catch (Exception ex) { return(Ok(new { status = HttpStatusCode.InternalServerError, valid = false, msg = ex.InnerException.Message })); } }