public static void Insert(FishingLoc fishLoc) { using (SQLiteConnection conn = new SQLiteConnection(App.DatabaseLocation)) { conn.CreateTable <FishingLoc>(); conn.InsertOrReplaceWithChildren(fishLoc, recursive: true); } }
public static FishingLoc GetFishingLocById(string id) { FishingLoc loc = new FishingLoc(); using (SQLiteConnection conn = new SQLiteConnection(App.DatabaseLocation)) { conn.CreateTable <FishingLoc>(); loc = conn.Table <FishingLoc>().Where(p => p.IdFishingLoc == id).FirstOrDefault(); } return(loc); }
public static int Delete(FishingLoc fishLoc) { using (SQLiteConnection conn = new SQLiteConnection(App.DatabaseLocation)) { conn.CreateTable <FishingLoc>(); int rows = conn.Delete <FishingLoc>(fishLoc.IdFishingLoc); if (rows > 0) { return(StaticValues.SUCCESS); } else { return(StaticValues.ERROR); } } }
public static FishingLoc GetNamedFishingLocById(string idUser, string idFishingLoc) { List <FishingLoc> fishingLocs = GetNamedFishingLoc(idUser); FishingLoc fl = new FishingLoc(); fl = (from l in fishingLocs where l.IdFishingLoc == null select l).ToList().FirstOrDefault(); if (fishingLocs.Count == 1) { return(fl); } else { return(null); } }