void DeleteDepartment() { Dept d = new Dept(); Console.Write("Enter Name = "); d.DName = Console.ReadLine(); if (deptService.DeleteDepartment(d.Id) > 0) { Console.WriteLine("Department Deleted"); } else { Console.WriteLine("Some error"); } }
protected void repeaterDept_ItemCommand(object source, RepeaterCommandEventArgs e) { var deptid = Convert.ToInt32(e.CommandArgument); if (e.CommandName == "Edit") { Response.Redirect("EditDept.aspx?id=" + deptid); } if (e.CommandName == "Delete") { DeptService service = new DeptService(); service.DeleteDepartment(deptid); Response.Redirect("DeptList.aspx"); } if (e.CommandName == "Details") { Response.Redirect("DetailDept.aspx?id=" + deptid); } }