public async static Task<UserApp> GetUserApp(long userId, AppApiType appType) { UserApp userApp = null; string commandText =@"select ua.* from UserApps ua inner join Users u on u.id = ua.UserId where u.Id = @userId and ua.ApiType = @apiType"; var parameters = new DynamicParameters(); parameters.Add("userId", userId); parameters.Add("apiType", appType.GetHashCode()); using (var conn = await DataAccessBase.GetOpenAsync(DataAccessBase.QuangAuthConn)) { var data = await conn.QueryAsync<UserApp>(commandText, parameters); userApp = data.ToList().First(); } return userApp; }
public UserApp GetUserApp(int userId, AppApiType appType) { UserApp userApp = null; List<Dictionary<string, string>> list = _database.Query("" + "select ua.* from UserApps ua " + "inner join Users u on u.id = ua.UserId " + "where u.Id = @userId " + "and ua.ApiType = @apiType", new Dictionary<string, object> { { "@userId", userId }, { "@apiType", appType.GetHashCode() } }); if (list != null && list.Count == 1) userApp = _parseUserAppObj(list[0]); return userApp; }
public Task<ResultUpdateOutput> UpdateUserApp(UpdateUserAppInput input, AppApiType appType) { Mapper.CreateMap<UpdateUserAppInput, UserApp>(); UserApp userApp = Mapper.Map<UserApp>((object)input); userApp.ApiType = appType; ResultUpdateOutput result = new ResultUpdateOutput() { Status = 1 }; if (this._userTable.UpdateUserApp(userApp) > 0) result.Status = 0; return Task.FromResult<ResultUpdateOutput>(result); }
public Task<UserApp> GetUserApp(int userId, AppApiType appType) { return Task.FromResult<UserApp>(this._userTable.GetUserApp(userId, appType)); }
/// <summary> /// /// </summary> /// <param name="userId"></param> /// <param name="appType"></param> /// <returns></returns> public async static Task<UserApp> GetUserApp(long userId, AppApiType appType) { return await UserDal.GetUserApp(userId, appType); }