/// <summary> /// Insert data into friend table /// </summary> /// <param name="db"></param> /// <param name="customerAccount"></param> /// <returns></returns> public int CreateFriend(IDbConnection db, friend friend) { string sql = @"INSERT INTO friend (sent_at, status, friend1_id, friend2_id) VALUES (@sent_at, @status, @friend1_id, @friend2_id)"; return db.Query<int>(sql, friend).FirstOrDefault(); }
private int SaveFriend(int myId, int myFriendId, string status = null) { var friend = new friend { friend1_id = myId, friend2_id = myFriendId, status = status }; var repo = Repo.Instance; using (var db = repo.OpenConnectionFromPool()) { return repo.CreateFriend(db, friend); } }