private void DeleteGenreExecute() { try { if (Genre == null) { MessageBox.Show("Morate selektovati zanr za brisanje!"); } else { bool okBrisanje = _dALGenre.DeleteGenre(Genre.Id); if (okBrisanje == false) { MessageBox.Show("Nije moguce izbrisati zanr filma!"); } else { Genres = _dALGenre.AllGenres(); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public IHttpActionResult DeleteGenre(int id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } Genre genre = _dALGenre.GetGenreById(id); if (id != genre.Id) { return(BadRequest()); } genre.Deleted = true; _dALGenre.DeleteGenre(genre.Id); return(StatusCode(HttpStatusCode.NoContent)); }