public async Task <IActionResult> GetWalletLedger(DateTime FromDate, DateTime ToDate, long WalletId, int Page, int?PageSize) { ListWalletLedgerResponse Response = new ListWalletLedgerResponse(); try { ApplicationUser user = new ApplicationUser(); user.Id = 1; //ApplicationUser user = await _userManager.GetUserAsync(HttpContext.User); if (user == null) { Response.ReturnCode = enResponseCode.Fail; Response.ReturnMsg = EnResponseMessage.StandardLoginfailed; Response.ErrorCode = enErrorCode.StandardLoginfailed; } else { var accessToken = await HttpContext.GetTokenAsync("access_token"); Response = _communicationService.GetWalletLedger(FromDate, ToDate, WalletId, Page, PageSize); } var respObj = JsonConvert.SerializeObject(Response); dynamic respObjJson = JObject.Parse(respObj); return(Ok(respObjJson)); } catch (Exception ex) { return(BadRequest(new BizResponseClass { ReturnCode = enResponseCode.InternalError, ReturnMsg = ex.ToString(), ErrorCode = enErrorCode.Status500InternalServerError })); } }
//vsolanki 14-11-2018 public ListWalletLedgerResponse GetWalletLedger(DateTime FromDate, DateTime ToDate, long WalletId, int page, int?PageSize) { try { ListWalletLedgerResponse res = new ListWalletLedgerResponse(); int Customday = Convert.ToInt32(_configuration["ReportValidDays"]);//2; double days = (ToDate - FromDate).TotalDays; if (Customday < days) { var msg = EnResponseMessage.MoreDays; msg = msg.Replace("#X#", Customday.ToString()); res.ReturnCode = enResponseCode.Fail; res.ErrorCode = enErrorCode.MoreDays; res.ReturnMsg = msg; return(res); } var items = _masterConfigurationRepository.GetWalletLedger(FromDate, ToDate, WalletId, page, PageSize); if (items.Count != 0) { res.ReturnCode = enResponseCode.Success; res.ErrorCode = enErrorCode.Success; res.ReturnMsg = EnResponseMessage.FindRecored; res.WalletLedgers = items; return(res); } res.ReturnCode = enResponseCode.Fail; res.ErrorCode = enErrorCode.RecordNotFound; res.ReturnMsg = EnResponseMessage.NotFound; return(res); } catch (Exception ex) { HelperForLog.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, ex); throw ex; } }