Exemple #1
0
        public static CustomerApiKey MapFull(this CustomerApiKey customerApiKey, bool locked, string lockedUntil)
        {
            customerApiKey.Locked = locked;

            if (locked == true)
            {
                customerApiKey.LockedOn    = DateTime.Now;
                customerApiKey.LockedUntil = DateTime.Parse(lockedUntil);
            }
            else
            {
                customerApiKey.LockedOn    = null;
                customerApiKey.LockedUntil = null;
            }

            return(customerApiKey);
        }
Exemple #2
0
        public static ApiKeyModel.CustomerApiKey MapFull(this CustomerApiKey customerApiKey)
        {
            ApiKeyModel.CustomerApiKey customerApiKeyModel = new ApiKeyModel.CustomerApiKey
            {
                Id                  = customerApiKey.Id,
                ApiKey              = customerApiKey.ApiKey,
                Comment             = customerApiKey.Comment,
                Expires             = customerApiKey.Expires,
                IsPublic            = customerApiKey.IsPublic,
                Locked              = customerApiKey.Locked,
                LockedOn            = customerApiKey.LockedOn,
                LockedUntil         = customerApiKey.LockedUntil,
                Created             = customerApiKey.Created,
                CreatedBy           = customerApiKey.CreatedBy,
                Changed             = customerApiKey.Changed,
                ChangedBy           = customerApiKey.ChangedBy,
                CustomerApiKeyRules = customerApiKey.CustomerApiKeyRules.MapFull(customerApiKey.Id),
            };

            return(customerApiKeyModel);
        }
Exemple #3
0
        public static CustomerApiKey MapFull(this ApiKeyModel.CustomerApiKey customerApiKeyModel, CustomerApiKey customerApiKey = null)
        {
            var tmp = customerApiKey ?? new CustomerApiKey();

            tmp.ApiKey    = customerApiKeyModel.ApiKey;
            tmp.Comment   = customerApiKeyModel.Comment;
            tmp.Expires   = customerApiKeyModel.Expires;
            tmp.IsPublic  = customerApiKeyModel.IsPublic;
            tmp.Created   = customerApiKeyModel.Created == DateTime.MinValue ? tmp.Created : customerApiKeyModel.Created;
            tmp.CreatedBy = customerApiKeyModel.CreatedBy ?? tmp.CreatedBy;
            tmp.Changed   = customerApiKeyModel.Changed;
            tmp.ChangedBy = customerApiKeyModel.ChangedBy;

            return(tmp);
        }