public int DeleteHobby(DeleteHobby deleteHobby) { ObjectParameter result = new ObjectParameter("Result", typeof(int)); using (TestingSample1Entities dataContext = new TestingSample1Entities()) { dataContext.HobbyDelete(deleteHobby.HobbyId, result); } return(Convert.ToInt32(result.Value)); }
public ActionResult Delete(int id) { int result = 0; try { DeleteHobby deleteHobby = new DeleteHobby() { HobbyId = id }; result = iHobby.DeleteHobby(deleteHobby); } catch { result = -1; } return(Json(result)); }