public int getIdByName() { try { Data.PREGUNTA_SECRETA question = Connection.LindaSonrisaDB.PREGUNTA_SECRETA.First(re => re.TXT_PREGUNTA == Question); return((int)question.ID); } catch (Exception) { return(0); } }
public bool Read() { try { Data.PREGUNTA_SECRETA question = Connection.LindaSonrisaDB.PREGUNTA_SECRETA.First(dbquestion => dbquestion.ID == Id); Id = (int)question.ID; Question = question.TXT_PREGUNTA; return(true); } catch (Exception) { return(false); } }
public bool Create() { try { Data.PREGUNTA_SECRETA question = Connection.LindaSonrisaDB.PREGUNTA_SECRETA.First(dbquestion => dbquestion.ID == Id); question.ID = LastId() + 1; question.TXT_PREGUNTA = Question; Connection.LindaSonrisaDB.PREGUNTA_SECRETA.Add(question); Connection.LindaSonrisaDB.SaveChanges(); return(true); } catch (Exception) { return(false); } }