Exemplo n.º 1
0
 public IHttpActionResult Delete(int id)
 {
     if (SerieDAO.Delete(id))
     {
         return(Ok());
     }
     return(BadRequest());
 }
Exemplo n.º 2
0
 public void ExcluirSerie(Serie _serie)
 {
     try
     {
         _DAO.Delete(_serie);
     }
     catch (DbUpdateException)
     {
         throw new Erros.ErroGeral("A Série não pode ser excluída pois existem Subséries vinculadas a ela.");
     }
     catch (Exception ex)
     {
         throw new Erros.ErroGeral("A operação não pode ser concluída. " + ex.Message);
     }
 }
 protected void grdSerie_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         long idSerie = Convert.ToInt64(e.CommandArgument);
         if (e.CommandName == "Modifica")
         {
             hfIdSerie.Value           = idSerie.ToString();
             txtNomeSerie.Text         = SerieDAO.GetAll().Where(w => w.IdSerie == idSerie).FirstOrDefault().NomeSerie;
             btnInserisciSerie.Visible = false;
             btnModificaSerie.Visible  = !btnInserisciSerie.Visible;
         }
         else if (e.CommandName == "Elimina")
         {
             SerieDAO.Delete(idSerie);
             BindGrid();
             (Master as layout).SetAlert("alert-success", $"Serie eliminata con successo");
         }
     }
     catch (Exception ex)
     {
         (Master as layout).SetAlert("alert-danger", $"Errore durante il grdSerie_RowCommand in GestisciSerie ===> {ex.Message}");
     }
 }