User1979860870 posted
Hi
Below is the Code. Parameter in Object is string but here i have given int.
public IHttpActionResult DeleteEmployee(int Id)
{
try
{
Employee employee = db.Employees.Find(Id);
if (employee == null)
{
//return BadRequest("Error Encountered : ");
return Content(HttpStatusCode.NotFound, "Employee not found");
}
else
{
db.Employees.Remove(employee);
db.SaveChanges();
return Ok();
}
}
catch (Exception ex)
{
return BadRequest("Error Encountered : " + ex);
}
}
Thanks