Esempio n. 1
0
 public ActionResult AddFilm([Bind(Include = "ID,Name,Surname,Age")] Actor actor)
 {
     if (ModelState.IsValid)
     {
         db.Entry(actor).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(actor));
 }
Esempio n. 2
0
        public ActionResult Addrecenzje(string Id, string Title, string Content)
        {
            Movie movie = db.Movies.Find(Int32.Parse(Id));
            int   rc    = movie.Reviews.FindLastIndex(a => a.ID > 0);

            rc++;
            movie.Reviews.Add(new Review
            {
                ID      = rc,
                Title   = Title,
                Content = Content
            });
            db.Entry(movie).State = EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("Details" + "/" + Id));

            return(View());
        }
Esempio n. 3
0
 public ActionResult Edit([Bind(Include = "ID,Title,Content")] Review review)
 {
     if (ModelState.IsValid)
     {
         db.Entry(review).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(review));
 }
Esempio n. 4
0
 public ActionResult Edit([Bind(Include = "ID,RateScore")] Rate rate)
 {
     if (ModelState.IsValid)
     {
         db.Entry(rate).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(rate));
 }
Esempio n. 5
0
        public ActionResult Ulubione(int?id)
        {
            String         userid  = User.Identity.GetUserName();
            List <Profile> profile = db.Profiles.ToList();
            Profile        profil  = profile.Find(x => x.UserName == userid);
            Movie          movie   = db.Movies.Find(id);



            if (!profil.Movies.Exists(m => m.ID == id))
            {
                profil.Movies.Add(movie);

                db.Entry(profil).State = EntityState.Modified;
                db.SaveChanges();
            }



            return(View(profil.Movies.ToList()));
        }