Esempio n. 1
0
 public static void Insert(FishingLoc fishLoc)
 {
     using (SQLiteConnection conn = new SQLiteConnection(App.DatabaseLocation))
     {
         conn.CreateTable <FishingLoc>();
         conn.InsertOrReplaceWithChildren(fishLoc, recursive: true);
     }
 }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
                }
            }
        }
Esempio n. 4
0
        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);
            }
        }