Example #1
0
        // GET: Ilces/DetaIlces/5
        public async Task <IActionResult> DetaIlces(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var entity = await _IlceServis.GetByIdAsync(id.Value);

            if (entity == null)
            {
                return(NotFound());
            }

            return(View(entity));
        }
        // GET: Musteris/Edit/5
        public async Task <IActionResult> Edit(int?id)
        {
            var model = new MusteriEditDto
            {
                Iller = (await _IlServis.GetSelectListAsync())
            };

            if (id == null)
            {
                return(View(model));
            }
            else
            {
                model.Musteri = await _MusteriServis.GetByIdAsync(id.Value);

                if (model.Musteri.Ilce != null)
                {
                    model.Musteri.Ilce = await _IlceServis.GetByIdAsync(model.Musteri.IlceId.Value);

                    model.Ilceler = await _IlceServis.GetSelectListAsync(i => i.IlId == model.Musteri.Ilce.IlId && i.Aktif);
                }


                if (model == null)
                {
                    return(NotFound());
                }

                return(View(model));
            }
        }
Example #3
0
        public async Task <KisiEditDto> GetEditDtoAsync(int?id)
        {
            KisiEditDto kisiEditDto = new KisiEditDto();
            var         tUyruk      = _uyrukServis.GetSelectListAsync(i => i.Aktif == true);
            var         tIller      = _IlServis.GetSelectListAsync(i => i.Aktif == true);
            var         tBankalar   = _bankaServis.GetSelectListAsync(i => i.Aktif == true);

            kisiEditDto.Uyruklar = await tUyruk;
            kisiEditDto.Iller    = await tIller;
            kisiEditDto.Bankalar = await tBankalar;

            if (id != null)
            {
                Task <Kisi> tkisi = GetByIdAsync(id.Value);

                kisiEditDto.Kisi = await tkisi;
                if (kisiEditDto.Kisi.IlceId.IsNotNull())
                {
                    kisiEditDto.Kisi.Ilce = await _IlceServis.GetByIdAsync(kisiEditDto.Kisi.IlceId.Value);

                    var tilceler = _IlceServis.GetSelectListAsync(i => i.IlId == kisiEditDto.Kisi.Ilce.IlId.ToInt(0) && i.Aktif == true);
                    kisiEditDto.Ilceler = await tilceler;
                }
            }
            return(kisiEditDto);
        }