예제 #1
0
        public ActionResult UpdatePartFilm(int id, string data, string type, bool error)
        {
            var part = db.FilmParts.Find(id);

            if (part == null)
            {
                HttpNotFound();
            }
            part.isError         = error;
            part.VideoData       = data;
            part.VideoType       = type;
            db.Entry(part).State = EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("ErrorDetails", new { id = part.FilmId }));
        }
예제 #2
0
        //
        // GET: /Admin/Category/

        public ActionResult Index(int id = 0)
        {
            if (id != 0)
            {
                var cat = db.Categories.Single(c => c.Id == id);
                if (cat != null)
                {
                    cat.Published       = !cat.Published;
                    cat.ModifiedDate    = DateTime.Now;
                    db.Entry(cat).State = EntityState.Modified;
                    db.SaveChanges();
                }
            }
            var categories = db.Categories.Where(c => c.CategoryParentId == null);

            return(View(categories.OrderBy(c => c.Order).ToList()));
        }
예제 #3
0
        public ActionResult ErrorFilm(string SEName, int order)
        {
            var filmpart = db.FilmParts.Single(p => p.Order == order && p.SEOName.StartsWith(SEName));

            filmpart.isError         = true;
            db.Entry(filmpart).State = EntityState.Modified;
            db.SaveChanges();
            return(Json(new { Success = true }, JsonRequestBehavior.AllowGet));
        }
예제 #4
0
 public ActionResult Edit(FilmPart filmpart)
 {
     if (ModelState.IsValid)
     {
         db.Entry(filmpart).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.FilmId = new SelectList(db.Films, "Id", "ImageUrl", filmpart.FilmId);
     return(View(filmpart));
 }
예제 #5
0
        public ActionResult Index(SettingModels setting)
        {
            if (ModelState.IsValid)
            {
                var listSetting = GenericModel.SetGeneric(setting, db.Settings);

                foreach (var s in listSetting)
                {
                    if (s.Id == 0)
                    {
                        db.Settings.Add(s);
                    }
                    else
                    {
                        db.Entry(s).State = EntityState.Modified;
                    }
                }
                db.SaveChanges();
            }
            return(View(setting));
        }