Beispiel #1
0
        public async Task <List <TotalVillageReportViewModel> > GetTotalReportAsync(string duration)
        {
            int hours = DurationToHours(duration);

            IList <ConsumptionModel> consumption = await _consumptionRepository.GetAsync(hours);

            return(consumption
                   .GroupBy(o => o.CounterId)
                   .Select(g => new TotalVillageReportViewModel
            {
                VillageName = g.FirstOrDefault().Counter.VillageName,
                Consumption = g.Sum(s => s.Amount)
            })
                   .ToList());
        }
        public virtual async void UpdateAsync()
        {
            if (GridModel != null)
            {
                var baseResponse = await repository.GetAsync(GridModel.Id);

                if (baseResponse != null && baseResponse.success)
                {
                    GridModel = baseResponse.dynamicObj;
                    this.CreateDeaultCommand();
                    SelectPageIndex = 1;
                }
                else
                {
                    Messenger.Default.Send("Get data exception!", "Snackbar");
                }
            }
        }
        public virtual async void UpdateAsync()
        {
            if (GridModel != null)
            {
                var baseResponse = await repository.GetAsync(GridModel.Id);

                if (baseResponse.StatusCode == 200)
                {
                    GridModel = JsonConvert.DeserializeObject <TEntity>(baseResponse.Result.ToString());
                    this.CreateDeaultCommand();
                    SelectPageIndex = 1;
                }
                else
                {
                    Messenger.Default.Send("Get data exception!", "Snackbar");
                }
            }
        }
Beispiel #4
0
        public virtual async void UpdateAsync()
        {
            if (GridModel == null)
            {
                return;
            }
            var baseResponse = await repository.GetAsync(GridModel.Id);

            if (baseResponse.StatusCode == 200)
            {
                GridModel = baseResponse.Result;
                this.CreateDeaultCommand();
                SelectPageIndex = 1;
            }
            else
            {
                WeakReferenceMessenger.Default.Send("Get data exception!", "Snackbar");
            }
        }