Exemplo n.º 1
0
 public static async Task <bool> AddOrUpdateUser(User user)
 {
     return(await Task.Run(() => {
         _db.Save(user);
         return true;
     }));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Insert a single <c>Location</c> object.
 /// </summary>
 /// <param name="location"></param>
 public void Insert(Location location)
 {
     using (var conn = new NpgsqlConnection(dbAccess.connectionString))
     {
         using (var db = new NPoco.Database(conn))
         {
             db.Connection.Open();
             db.Save <LocationDto>(LocationDto.Translate(location));
             db.Connection.Close();
         }
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Insert a single <c>Target</c> object.
        /// </summary>
        /// <param name="target"></param>
        public void Insert(Target target)
        {
            using (var conn = new NpgsqlConnection(dbAccess.connectionString))
            {
                using (var db = new NPoco.Database(conn))
                {
                    var dto = TargetDto.Translate(target);

                    db.Connection.Open();
                    db.Save <TargetDto>(TargetDto.Translate(target));
                    db.Connection.Close();
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Insert a single <c>Person</c> object.
        /// </summary>
        /// <param name="person"></param>
        public void Insert(Person person)
        {
            using (var conn = new NpgsqlConnection(dbAccess.connectionString))
            {
                using (var db = new NPoco.Database(conn))
                {
                    db.Connection.Open();

                    PersonDto pdto = PersonDto.Translate(person);
                    pdto.DateCreated = DateTime.Now;

                    db.Save <PersonDto>(pdto);
                    db.Connection.Close();
                }
            }
        }
Exemplo n.º 5
0
 public int Save(IdentityObject entity)
 {
     db.Save <IdentityObject>(entity);
     return(entity.Id);
 }