public void AddApiKey(ref ApiKeyBase apiKey) { Requires.NotNull(apiKey); using (var context = DataContext.Instance()) { var rep = context.GetRepository <ApiKeyBase>(); rep.Insert(apiKey); } }
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); } }
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))); }