Example #1
0
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        Button btn;

        foreach (GridViewRow gr in GridView1.Rows)
        {
            if (gr.RowIndex == e.RowIndex)
            {
                btn       = (Button)gr.FindControl("btndelete");
                income.Id = int.Parse(btn.CommandArgument.ToString());
            }

            income.DeleteIncome();
            lblMsg.Text = "Deleted...!";
            BindData();
        }
    }
        public IActionResult Delete(long id)
        {
            bool result = false;

            try
            {
                result = incomeBL.DeleteIncome(id);
                if (result == false)
                {
                    return(NotFound());
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception in getting Delete Income", e);
            }
            return(new NoContentResult());
        }