コード例 #1
0
        public ActionResult DeleteCustomer(short Id)
        {
            using (DataBase4VidlyEntities context = new DataBase4VidlyEntities())
            {
                var client = context.Clients.SingleOrDefault(c => c.Id == Id);

                context.Clients.Remove(client);

                context.SaveChanges();

                return(View("Index"));
            };
        }
コード例 #2
0
        public ActionResult DeleteMovie(short Id)
        {
            using (DataBase4VidlyEntities context = new DataBase4VidlyEntities())
            {
                var film = context.Films.SingleOrDefault(c => c.Id == Id);

                context.Films.Remove(film);

                context.SaveChanges();

                return(View("Index"));
            };
        }
コード例 #3
0
        public ActionResult Creator(string Titre, string Genre)
        {
            using (DataBase4VidlyEntities context = new DataBase4VidlyEntities())
            {
                var LastFilm = context.Films.OrderByDescending(o => o.Id).FirstOrDefault();

                var LastIdFilm = LastFilm.Id;

                var NextId = LastIdFilm + 1;

                var Fl = new Film()
                {
                    Id    = NextId,
                    Titre = Titre,
                    Genre = Genre
                };

                context.Films.Add(Fl);

                context.SaveChanges();

                return(View("Index"));
            };
        }