public List <CampainItemResponse> ActiveCampain_GetCampains(string userId, string accId) { List <CampainItemResponse> result = new List <CampainItemResponse>(); var apiSite = _dbSet.AsNoTracking().FirstOrDefault(x => x.UserId == userId && x.AccId == accId); if (apiSite == null) { return(result); } string apiKey = apiSite.ApiKey; ActiveCampainTask task = new ActiveCampainTask(apiSite.AccId, apiKey); var res = task.GetCampaigns(); if (res.Code == System.Net.HttpStatusCode.OK) { result = (List <CampainItemResponse>)res.Data; } else { throw new BusinessException(res.Message); } return(result); }
public Integration ActiveCampain_Auth(string url, string apiKey, string userId) { Integration result = new Integration(); ActiveCampainTask task = new ActiveCampainTask(url, apiKey); var res = task.Auth(); if (res.Code == System.Net.HttpStatusCode.OK) { var resultAuth = (AccountResponse)res.Data; //save info var info = new Integration() { Id = Guid.NewGuid(), SiteId = (int)IntegrationType.ActiveCampain, AccId = url, Email = url.Replace("https://", "").Replace("http://", ""), ApiKey = apiKey, UserId = userId, LastConnectedDate = DateTime.Now }; IU(info, userId); result = info; } else { throw new BusinessException(res.Message); } return(result); }