/// <summary> /// 修改UserPositionInfo /// </summary> /// <param name="userposition"></param> /// <returns></returns> public static int UpdateUserPosition(UserPositionInfo userposition) { string sql = @"UPDATE [UserPosition] SET Code=@Code, Type=@Type WHERE UserId=@UserId"; var par = new DynamicParameters(); par.Add("@UserId", userposition.UserId, DbType.Int32); par.Add("@Code", userposition.Code, DbType.Int32); par.Add("@Type", userposition.Type, DbType.Int16); return(DapWrapper.InnerExecuteSql(DbConfig.ArticleManagerConnString, sql, par)); }
/// <summary> /// DataModel 转 ViewModel /// </summary> /// <param name="userpositionInfo"></param> /// <returns></returns> public static UserPositionVModel UserPositionInfoToVModel(UserPositionInfo userpositionInfo) { if (userpositionInfo == null) { return(new UserPositionVModel()); } return(new UserPositionVModel { UserId = userpositionInfo.UserId, Code = userpositionInfo.Code, Type = userpositionInfo.Type }); }
/// <summary> /// DataModel 转 ViewModel /// </summary> /// <param name="userposition"></param> /// <returns></returns> public static UserPositionVModel UserPositionInfoToVModel(UserPositionInfo userposition) { if (userposition == null) { return(new UserPositionVModel()); } return(new UserPositionVModel { Id = userposition.Id, UserId = userposition.UserId, Code = userposition.Code, Type = userposition.Type, CreateTime = userposition.CreateTime }); }
/// <summary> /// 添加UserPositionInfo /// </summary> /// <param name="userposition"></param> /// <returns></returns> public static int AddUserPosition(UserPositionInfo userposition) { string sql = @"INSERT INTO [UserPosition] ([UserId],[Code],[Type]) VALUES (@UserId,@Code,@Type) SELECT SCOPE_IDENTITY() " ; var par = new DynamicParameters(); par.Add("@UserId", userposition.UserId, DbType.Int32); par.Add("@Code", userposition.Code, DbType.Int32); par.Add("@Type", userposition.Type, DbType.Int16); return(DapWrapper.InnerQueryScalarSql <int>(DbConfig.ArticleManagerConnString, sql, par)); }
/// <summary> /// 修改UserPositionInfo /// </summary> /// <param name="userposition"></param> /// <returns></returns> public static int UpdateUserPosition(UserPositionInfo userposition) { return(DataProvider.UserPositions.UpdateUserPosition(userposition)); }
/// <summary> /// 添加UserPositionInfo /// </summary> /// <param name="userposition"></param> /// <returns></returns> public static long AddUserPosition(UserPositionInfo userposition) { return(DataProvider.UserPositions.AddUserPosition(userposition)); }