If my condition fails as rdr.HasRows == true
, how can I respond my controller its fails
public Employee DeleteEmpById(int key)
{
try
{
SqlCommand cmd = new SqlCommand("Sp_GetEmployeeById", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@EmpId", key);
SqlDataReader rdr = cmd.ExecuteReader();
if (rdr.HasRows == true)
{
}
else
// Here what I mention when rdr.HasRows false
}
Controller
public ActionResult DeleteById(int id)
{
var x = ObjRepo.DeleteEmpById(id);
return View(x);
}