public static async Task <bool> AddOrUpdateUser(User user) { return(await Task.Run(() => { _db.Save(user); return true; })); }
/// <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(); } } }
/// <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(); } } }
/// <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(); } } }
public int Save(IdentityObject entity) { db.Save <IdentityObject>(entity); return(entity.Id); }