Beispiel #1
0
        private async Task GetCount()
        {
            var response = await service.GetCount(this.SerialId);

            if (response.IsSuccessStatusCode)
            {
                var meter = await service.GetById(this.SerialId);

                this.Count = meter.Count;
            }
        }
        public async Task <IActionResult> GetCount(string SerialId)
        {
            var jwt = JwtService.GetJwt(HttpContext);

            if (jwt != null)
            {
                EnergyMetersService service = new EnergyMetersService(jwt);
                var responseMessage         = await service.GetCount(jwt, SerialId);

                if (responseMessage.IsSuccessStatusCode)
                {
                    return(Redirect("GetAll"));
                }
                return(BadRequest());
            }
            else
            {
                return(RedirectToRoute(new { controller = "Account", action = "Login" }));
            }
        }