Example #1
0
        public ActionResult GaleriDuzenle(int id)
        {
            Galeri      galeri = galeriServis.Bul(id);
            GaleriModel model  = Mapper.Map <Galeri, GaleriModel>(galeri);

            model.Haberler = Haberler;

            return(View(model));
        }
Example #2
0
        public ActionResult GaleriEkle()
        {
            GaleriModel model = new GaleriModel
            {
                Haberler = Haberler
            };

            return(View(model));
        }
Example #3
0
        public ActionResult GaleriDuzenle(GaleriModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    Galeri galeri = galeriServis.Bul(model.Id);
                    galeri = (Galeri)Mapper.Map(model, galeri, typeof(GaleriModel), typeof(Galeri));
                    galeriServis.Guncelle(galeri);

                    return(RedirectToAction("Galeriler"));
                }
                catch (Exception ex)
                {
                }
            }

            model.Haberler = Haberler;
            return(View(model));
        }
Example #4
0
        public ActionResult GaleriEkle(GaleriModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    Galeri galeri = Mapper.Map <GaleriModel, Galeri>(model);
                    galeriServis.Ekle(galeri);

                    return(RedirectToAction("Galeriler"));
                }
                catch (Exception ex)
                {
                    model = new GaleriModel
                    {
                        Haberler = Haberler
                    };
                }
            }
            return(View(model));
        }