Exemplo n.º 1
0
        public void DeleteItem()
        {
            DataServiceContext ctx = new DataServiceContext(new Uri("http://localhost/Chapter9/MovieService.svc"));

            MovieService.Film FilmToDelete =
                ctx.Execute <MovieService.Film>(new Uri("Films(1)", UriKind.Relative)).First();
            ctx.DeleteObject(FilmToDelete);
            ctx.SaveChanges();
        }
Exemplo n.º 2
0
        public void AddNewItem()
        {
            DataServiceContext ctx = new DataServiceContext(new Uri("http://localhost/Chapter9/MovieService.svc"));

            MovieService.Film NewFilm = new MovieService.Film();
            NewFilm.Title       = "Pulp Fiction";
            NewFilm.Length      = 124;
            NewFilm.Description = "Quentins classic movie";
            ctx.AddObject("Films", NewFilm);
            ctx.SaveChanges();
        }