示例#1
0
        public ActionResult DeleteConfirmed(int id)
        {
            HomePageSlider homePageSlider = db.HomePageSlider.Find(id);

            db.HomePageSlider.Remove(homePageSlider);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#2
0
 public ActionResult Edit([Bind(Include = "Id,SliderTitle,SliderDescription")] HomePageSlider homePageSlider)
 {
     if (ModelState.IsValid)
     {
         db.Entry(homePageSlider).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(homePageSlider));
 }
示例#3
0
        public ActionResult Create([Bind(Include = "Id,SliderTitle,SliderDescription")] HomePageSlider homePageSlider)
        {
            if (ModelState.IsValid)
            {
                db.HomePageSlider.Add(homePageSlider);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(homePageSlider));
        }
示例#4
0
 public bool UpdateSlider(HomePageSlider Slider)
 {
     try
     {
         repository.EditEntity(Slider);
         return(repository.SaveToDatabase() > 0);
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#5
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HomePageSlider homePageSlider = db.HomePageSlider.Find(id);

            if (homePageSlider == null)
            {
                return(HttpNotFound());
            }
            return(View(homePageSlider));
        }
示例#6
0
        public ActionResult DahaFazlasi(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }
            HomePageSlider pageSlider = context.HomePageSlider.Find(id);

            if (pageSlider == null)
            {
                return(HttpNotFound());
            }
            return(View(pageSlider));
        }
示例#7
0
 public ActionResult Edit(HomePageSlider slider, HttpPostedFileBase file)
 {
     if (ModelState.IsValid)
     {
         if (file != null)
         {
             file.SaveAs(HttpContext.Server.MapPath("~/Image/") + file.FileName);
             slider.ImageName = file.FileName;
         }
         service.UpdateSlider(slider);
         return(RedirectToAction("Add"));
     }
     else
     {
         return(View(slider));
     }
 }
示例#8
0
 public HomePageSlider AddSlider(HomePageSlider Slider)
 {
     try
     {
         if (repository.IsExist(x => x.Name == Slider.Name || x.ImageName == Slider.ImageName))
         {
             Slider.Id = -1;
             return(Slider);
         }
         else
         {
             repository.AddEntity(Slider);
             repository.SaveToDatabase();
             return(Slider);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#9
0
        public async System.Threading.Tasks.Task PullCustom()
        {
            var reqUrl = targetURLs.GetHomePageSliderCustomURL();
            var movies = RequestHelper.Call <HomePageSliderJson>(reqUrl);


            foreach (var item in movies.Group)
            {
                var homePageModel = new HomePageSlider();
                Console.WriteLine(item.Key);

                List <HomePageSliderMovie> homePageSliderMovies = new List <HomePageSliderMovie>();

                foreach (var content in movies.Group[item.Key].Content)
                {
                    var contentModel = new HomePageSliderMovie();

                    Console.WriteLine(content.ArTitle);

                    contentModel.Movie = await _context.Movies.Where(Q => Q.Nb == content.Nb).FirstOrDefaultAsync();

                    contentModel.HomePageSlider = homePageModel;
                    homePageSliderMovies.Add(contentModel);
                }


                homePageModel.Comments             = "";
                homePageModel.Options              = "";
                homePageModel.Type                 = "2";
                homePageModel.Name                 = item.Key;
                homePageModel.Order                = 1;
                homePageModel.HomePageSliderMovies = homePageSliderMovies;

                _context.HomePageSliders.Add(homePageModel);
                _context.SaveChanges();
            }
        }
示例#10
0
 public ActionResult Remove(HomePageSlider slider)
 {
     service.RemoveSlider(slider);
     return(RedirectToAction("index"));
 }