public int DeleteHobbies([FromBody] DeleteModels hobby) { FRDBEntities db = new FRDBEntities(); FRDBEntities db1 = new FRDBEntities(); int id, hid; using (db1) { int?i = db1.GetUserId(hobby.email).FirstOrDefault(); id = i ?? 0; } using (FRDBEntities db2 = new FRDBEntities()) { hid = db2.GetHobbyByName(hobby.value).FirstOrDefault <GetHobbyByName_Result>().id; } using (db) { return(db.DeleteUserHobbies(id, hid)); } }