Exemple #1
0
        // GET: EczaneNobet/EczaneUzaklikMatris
        public ActionResult Index()
        {
            //var user = _userService.GetByUserName(User.Identity.Name);
            //var nobetUstGruplar = _nobetUstGrupService.GetListByUser(user).Select(s => s.Id);
            var ustGrupSession = _nobetUstGrupSessionService.GetSession("nobetUstGrup");

            var nobetUstGrupId = ustGrupSession.Id;

            var eczaneGrupIdList = _nobetGrupService.GetListByNobetUstGrupId(nobetUstGrupId).Select(s => s.Id).ToList();

            var nobetciEczaneler = _eczaneNobetGrupService.GetAktifEczaneNobetGrupList(eczaneGrupIdList);
            //nobetciEczaneler = nobetciEczaneler.Take(10).ToList();

            var model = new EczaneUzaklikMatrisViewModel
            {
                Eczaneler      = new List <Eczane>(),
                NobetUstGrupId = nobetUstGrupId,
                //Uzakliklar = new List<EczaneUzaklikMatrisDetay>()
            };

            foreach (var item in nobetciEczaneler)
            {
                var adres           = _eczaneService.GetById(item.EczaneId).Adres;
                var enlem           = _eczaneService.GetById(item.EczaneId).Enlem;
                var boylam          = _eczaneService.GetById(item.EczaneId).Boylam;
                var telefonNo       = _eczaneService.GetById(item.EczaneId).TelefonNo;
                var adresTarifi     = _eczaneService.GetById(item.EczaneId).AdresTarifi;
                var adresTarifiKisa = _eczaneService.GetById(item.EczaneId).AdresTarifiKisa;

                model.Eczaneler.Add(new Eczane
                {
                    Id              = item.EczaneId,
                    Adi             = item.EczaneAdi,
                    Adres           = adres,
                    Enlem           = enlem,
                    Boylam          = boylam,
                    TelefonNo       = telefonNo,
                    AdresTarifi     = adresTarifi,
                    AdresTarifiKisa = adresTarifiKisa
                });
            }

            SetUzakliklarKusUcusu(model.Eczaneler);

            var sonuclar = _eczaneUzaklikMatrisService.GetDetaylar(nobetUstGrupId);

            model.Uzakliklar = sonuclar;

            return(View(model));
        }