Ejemplo n.º 1
0
 public void AddApiKey(ref ApiKeyBase apiKey)
 {
     Requires.NotNull(apiKey);
     using (var context = DataContext.Instance())
     {
         var rep = context.GetRepository <ApiKeyBase>();
         rep.Insert(apiKey);
     }
 }
Ejemplo n.º 2
0
 public void UpdateApiKey(ApiKeyBase apiKey)
 {
     Requires.NotNull(apiKey);
     Requires.PropertyNotNegative(apiKey, "ApiKeyId");
     using (var context = DataContext.Instance())
     {
         var rep = context.GetRepository <ApiKeyBase>();
         rep.Update(apiKey);
     }
 }
Ejemplo n.º 3
0
        public ActionResult Keys(int conferenceId, NewKeyDTO data)
        {
            var newKey = new ApiKeyBase()
            {
                ConferenceId    = conferenceId,
                ApiKey          = Guid.NewGuid().ToString("N"),
                CreatedByUserID = User.UserID,
                CreatedOnDate   = DateTime.Now
            };

            if (!string.IsNullOrEmpty(data.Expires))
            {
                DateTime expiryDate;
                if (DateTime.TryParse(data.Expires, out expiryDate))
                {
                    newKey.Expires = expiryDate;
                }
            }
            ApiKeyRepository.Instance.AddApiKey(ref newKey);
            DotNetNuke.Framework.ServicesFramework.Instance.RequestAjaxAntiForgerySupport();
            return(View(ConferenceRepository.Instance.GetConference(PortalSettings.PortalId, conferenceId)));
        }