public ActionResult DeleteConfirmed(int id) { HomePageSlider homePageSlider = db.HomePageSlider.Find(id); db.HomePageSlider.Remove(homePageSlider); db.SaveChanges(); return(RedirectToAction("Index")); }
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)); }
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)); }
public bool UpdateSlider(HomePageSlider Slider) { try { repository.EditEntity(Slider); return(repository.SaveToDatabase() > 0); } catch (Exception) { throw; } }
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)); }
public ActionResult DahaFazlasi(int?id) { if (id == null) { return(HttpNotFound()); } HomePageSlider pageSlider = context.HomePageSlider.Find(id); if (pageSlider == null) { return(HttpNotFound()); } return(View(pageSlider)); }
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)); } }
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; } }
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(); } }
public ActionResult Remove(HomePageSlider slider) { service.RemoveSlider(slider); return(RedirectToAction("index")); }