コード例 #1
0
        public IHttpActionResult DeleteMovie(int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            Movie movie = _dALMovie.GetMovieById(id);

            if (id != movie.Id)
            {
                return(BadRequest());
            }

            movie.Deleted = true;
            _dALMovie.DeleteMovie(movie.Id);

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
        private void DeleteMovieExecute()
        {
            try
            {
                if (Movie == null)
                {
                    MessageBox.Show("Morate selektovati film za brisanje!");
                }

                bool okBrisanje = _dALMovie.DeleteMovie(Movie.Id);
                if (okBrisanje == false)
                {
                    MessageBox.Show("Nije moguce izbrisati film!");
                }
                else
                {
                    Movies = _dALMovie.AllMovies();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }