示例#1
0
        public UserPreferenceRetrieveResponse Retrieve(IDbConnection connection, UserPreferenceRetrieveRequest request)
        {
            if (request is null)
            {
                throw new ArgumentNullException("request");
            }
            if (request.Name is null)
            {
                throw new ArgumentNullException("name");
            }
            if (request.PreferenceType is null)
            {
                throw new ArgumentNullException("preferenceType");
            }

            var userId = Convert.ToInt32(Context.User.GetIdentifier());
            var row    = connection.TryFirst <MyRow>(
                fld.UserId == userId &
                fld.PreferenceType == request.PreferenceType &
                fld.Name == request.Name);

            if (row == null)
            {
                return(new UserPreferenceRetrieveResponse());
            }

            return(new UserPreferenceRetrieveResponse
            {
                Value = row.Value
            });
        }
        public UserPreferenceRetrieveResponse Retrieve(IDbConnection connection, UserPreferenceRetrieveRequest request)
        {
            Check.NotNull(request, "request");
            Check.NotNull(request.Name, "name");
            Check.NotNull(request.PreferenceType, "preferenceType");

            var userId = (Authorization.UserDefinition as UserDefinition).UserId;
            var row = connection.TryFirst<MyRow>(
                fld.UserId == userId &
                fld.PreferenceType == request.PreferenceType &
                fld.Name == request.Name);

            if (row == null)
                return new UserPreferenceRetrieveResponse();

            return new UserPreferenceRetrieveResponse
            {
                Value = row.Value
            };
        }
        public UserPreferenceRetrieveResponse Retrieve(IDbConnection connection, UserPreferenceRetrieveRequest request)
        {
            Check.NotNull(request, "request");
            Check.NotNull(request.Name, "name");
            Check.NotNull(request.PreferenceType, "preferenceType");

            var userId = (Authorization.UserDefinition as UserDefinition).UserId;
            var row = connection.TryFirst<MyRow>(
                fld.UserId == userId &
                fld.PreferenceType == request.PreferenceType &
                fld.Name == request.Name);

            if (row == null)
                return new UserPreferenceRetrieveResponse();

            return new UserPreferenceRetrieveResponse
            {
                Value = row.Value
            };
        }
示例#4
0
 public UserPreferenceRetrieveResponse Retrieve(IDbConnection connection, UserPreferenceRetrieveRequest request)
 {
     return(new MyRepository().Retrieve(connection, request));
 }
 public UserPreferenceRetrieveResponse Retrieve(IDbConnection connection, UserPreferenceRetrieveRequest request)
 {
     return new MyRepository().Retrieve(connection, request);
 }