Example #1
0
        public ActionResult EditConfirmed(Videofilm videofilm)
        {
            if (!videofilm.CustomerId.HasValue)
            {
                videofilm.Customer   = null;
                videofilm.CustomerId = null;
            }
            else if (repositoryCustomer.Get(videofilm.CustomerId.GetValueOrDefault()) == null)
            {
                return(View("Error"));
            }



            if (videofilm == null)
            {
                return(HttpNotFound());
            }
            else
            {
                repository.Edit(videofilm);
                repository.SaveChanges();
                return(RedirectToAction("Index"));
            }
        }
Example #2
0
        public ActionResult Create(Videofilm videoFilm)
        {
            if (!ModelState.IsValid)
            {
                return(View("VideoFilms"));
            }

            repository.Add(videoFilm);
            repository.SaveChanges();
            return(RedirectToAction("index"));
        }
Example #3
0
        public ActionResult Delete(int id)
        {
            Videofilm videofilm = repository.Get(id);

            if (videofilm == null)
            {
                return(HttpNotFound());
            }
            else
            {
                return(View(videofilm));
            }
        }
        public ActionResult Create(Videofilm videofilm)
        {
            try
            {
                db.Videofilmer.Add(videofilm);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Example #5
0
        public ActionResult DeleteConfirmed(int id)
        {
            Videofilm videofilm = repository.Get(id);

            if (videofilm == null)
            {
                return(HttpNotFound());
            }
            else
            {
                repository.Remove(videofilm);
                repository.SaveChanges();
                return(RedirectToAction("index"));
            }
        }
Example #6
0
 public ActionResult Find(Videofilm videoFilm)
 {
     return(View(repository.Get(videoFilm.Id)));
 }