public async Task <IActionResult> GetMeters(string s, string v)
        {
            try
            {
                if (v != null)
                {
                    ViewBag.added = "Yes";
                }
                var meters = await _meterRepository.GetAll();

                ViewBag.PageName = "Meters";
                if (await _meterRepository.Count() > 4)
                {
                    var firstFourAdmins = meters.Take(4);

                    ViewBag.FourMeters = firstFourAdmins;
                    ViewBag.meters     = meters;
                }

                ViewBag.Meters  = meters;
                ViewBag.Estates = new SelectList(await _estateRepository.GetAll(), "EstateId", "EstateName");
                return(View());
            }
            catch (Exception)
            {
                return(null);

                throw;
            }
        }
示例#2
0
        public List <MeterDto> GetAll()
        {
            var meters = _mapper.Map <List <Meter>, List <MeterDto> >(_meterRepository.GetAll());

            if (meters == null)
            {
                return(new List <MeterDto>());
            }

            foreach (var meter in meters)
            {
                _ticketService.CheckCommandSituation(meter);
            }

            return(meters);
        }