public async Task <List <SavingsCategory> > GetGraphData(DataRequestModel dataRequestModel) { UriBuilder uriBuilder = new UriBuilder(ApiConstants.BaseUri) { Path = ApiConstants.GetGraphData }; List <SavingsCategory> weeklySavings = await _genericRepository.PostAsync <DataRequestModel, List <SavingsCategory> >(uriBuilder.ToString(), dataRequestModel); return(weeklySavings); }
public virtual PagingList <TEntity> GetPagingList(DataRequestModel requestModel) { var query = EntityRepository.TableNoTracking; if (!string.IsNullOrEmpty(requestModel.SortField)) { query = query.OrderByDirection(requestModel.SortField, requestModel.ListSortDirection); } return(query.ToPagingList(requestModel.PageIndex, requestModel.PageSize)); }
public IHttpActionResult GetGraphData(DataRequestModel dataRequestModel) { if (dataRequestModel.UserDataID != 0) { int year = DateTime.UtcNow.Year; if (dataRequestModel.Type == GlobalConstants.Type_Amount || dataRequestModel.Type == GlobalConstants.Type_Category) { bool hasCategory = dataRequestModel.Type == GlobalConstants.Type_Amount ? false : true; int categoryID = hasCategory? db.Categories.Where(e => e.CategoryName.Equals(dataRequestModel.CategoryName)).FirstOrDefault().CategoryID : 0; if (dataRequestModel.Period == GlobalConstants.Period_CurrentMonth || dataRequestModel.Period == GlobalConstants.Period_PreviousMonth) { //List<SavingsWeekly> weeklySavingsData = this.GetWeeklyExpenseData(dataRequestModel.Period, dataRequestModel.UserDataID, hasCategory, categoryID); List <SavingsCategory> weeklySavingsData = this.GetExpenseDataCategoryWise(dataRequestModel.Period, dataRequestModel.UserDataID, hasCategory, categoryID, year); if (weeklySavingsData != null && weeklySavingsData.Any()) { return(Ok(weeklySavingsData)); } else { return(Ok(new List <SavingsCategory>())); } } else if (dataRequestModel.Period == GlobalConstants.Period_HalfYearly || dataRequestModel.Period == GlobalConstants.Period_FullYear) { List <SavingsMonthly> monthlySavingsdata = this.GetMonthlyExpenseData(dataRequestModel.Period, dataRequestModel.UserDataID, hasCategory, categoryID); if (monthlySavingsdata != null && monthlySavingsdata.Any()) { return(Ok(monthlySavingsdata)); } else { return(Ok(new List <SavingsMonthly>())); } } else { return(BadRequest()); } } else { return(BadRequest()); } } else { return(BadRequest()); } }
public IActionResult List(DataRequestModel requestModel) { var pagingList = _userSvc.GetPagingList(requestModel); var responseModel = pagingList.ToDataResponse(); responseModel.Rows = pagingList.Select(user => new ApplicationUserModel { Id = user.Id, UserName = user.UserName, Email = user.Email, PhoneNumber = user.PhoneNumber, LockoutEnabled = user.LockoutEnabled }); return(Json(responseModel)); }
public async Task <TotalData> Graph([FromForm] DataRequestModel request) { var result = new TotalData(); if (!DateTime.TryParseExact(request.From, "yyyyMMdd", null, System.Globalization.DateTimeStyles.AdjustToUniversal, out var from)) { return(result); } if (!DateTime.TryParseExact(request.To, "yyyyMMdd", null, System.Globalization.DateTimeStyles.AdjustToUniversal, out var to)) { return(result); } from = from.AddMinutes(request.Offset); to = to.AddMinutes(request.Offset); result.Swing = (await _tableService.GetSwingDatas(request.Id, from, to)).OrderBy(c => c.ClubType).ThenBy(c => c.Date).ToArray(); result.Date = result.Swing.Select(s => s.Date).Distinct().OrderBy(d => d).Select(d => new Date(d)).ToArray(); return(result); }
public async Task <SwingDataModel[]> Post([FromForm] DataRequestModel request) { var user = UserModel.FromUserClaims(HttpContext.User); if (user == null) { return(null); } if (!DateTime.TryParseExact(request.From, "yyyyMMdd", null, System.Globalization.DateTimeStyles.AdjustToUniversal, out var from)) { return(null); } if (!DateTime.TryParseExact(request.To, "yyyyMMdd", null, System.Globalization.DateTimeStyles.AdjustToUniversal, out var to)) { return(null); } from = from.AddMinutes(request.Offset); to = to.AddMinutes(request.Offset); return(await _tableService.GetSwingDatas(user.DeviceId, from, to)); }