Exemplo n.º 1
0
        public ActionResult Delete(Movie movieTemp)
        {
            var movie = this.context.Movies.FirstOrDefault(m => m.Id == movieTemp.Id);
            this.context.Movies.Remove(movie);

            this.context.SaveChanges();

            return View("Success");
        }
Exemplo n.º 2
0
        public ActionResult Create(string title, string year)
        {
            if (this.ModelState.IsValid)
            {
                var movie = new Movie
                {
                    Title = title,
                    Year = short.Parse(year)
                };

                this.context.Movies.Add(movie);
                this.context.SaveChanges();
            }

            var all = this.context.Movies.ToList();

            //can't figure out why isn't it replacing 
            return this.PartialView("_MovieResult", all);
        }