public static T Obter() { try { var context = new ContextDAO(); return(context.database.Table <T>().FirstOrDefault()); } catch (Exception ex) { throw ex; } }
public static void Alterar(T conf) { try { var context = new ContextDAO(); context.database.Update(conf); } catch (Exception ex) { throw ex; } }
public static void Inserir(T conf) { try { var context = new ContextDAO(); context.database.Insert(conf); } catch (Exception ex) { throw ex; } }
public static Parceiro Get() { try { var context = new ContextDAO(); var retorno = context.database.Table <Parceiro>().FirstOrDefault(); return(retorno); } catch (Exception e) { throw; } }
public static bool InsertConfig(Parceiro c) { try { var context = new ContextDAO(); context.database.DeleteAll <Parceiro>(); return(context.database.Insert(c) > 0); } catch (Exception e) { throw; } }
public static bool DeleteConfig() { try { var context = new ContextDAO(); var config = context.database.Table <Config>().FirstOrDefault(); if (config != null) { context.database.Delete(config); } return(true); } catch (Exception e) { throw; } }
public static bool InsertConfig(Config c) { try { var context = new ContextDAO(); c.CodConfig = 1; if (!context.database.Table <Config>().Any()) { return(context.database.Insert(c) > 0); } else { return(context.database.Update(c) > 0); } } catch (Exception e) { throw; } }