public async Task <IHttpActionResult> CheckModerationsAds() { var db = IlevusDBContext.Create(); var filters = Builders <Ad> .Filter; var collection = db.GetAdsCollection(); try { var directed = collection.Find( filters.And( filters.Eq("Active", true), filters.Or( filters.Eq("Status", Enums.ModerationAds.WaitingAnalysis), filters.Eq("Status", Enums.ModerationAds.OnAnalysing) ), filters.Lt("Moderator.AnalysisHour", DateTime.Now.AddMinutes(-5)) ) ); var ads = await directed.ToListAsync(); if (ads != null) { return(Ok(ads)); } return(Ok(new List <Ad>())); } catch (Exception e) { return(InternalServerError(e)); } }
public async Task <IHttpActionResult> RemoveTask(WheelOfLifeRemoveTaskBindingModel model) { var db = IlevusDBContext.Create(); var filters = Builders <CoachingProcess> .Filter; var updates = Builders <CoachingProcess> .Update; var collection = db.GetCoachingProcessCollection(); try { var process = (await collection.FindAsync(filters.Eq("Id", model.ProcessId))).FirstOrDefault(); if (process != null) { var session = process.Sessions[model.Session]; if (session == null || session.WheelOfLifeTool == null) { return(BadRequest("Sessão inválida.")); } session.WheelOfLifeTool.Tasks.RemoveAt(model.Task); await collection.UpdateOneAsync(filters.Eq("Id", model.ProcessId), updates.Combine( updates.Set("Sessions", process.Sessions), updates.Set("LastModified", DateTime.Now) ) ); return(Ok(true)); } return(NotFound()); } catch (Exception e) { return(InternalServerError(e)); } }
public async Task <IHttpActionResult> GetMyMeetings() { var user = await UserManager.FindByNameAsync(User.Identity.Name); var db = IlevusDBContext.Create(); var filters = Builders <MeetingSchedule> .Filter; var collection = db.GetMeetingScheduleCollection(); try { var results = await collection.FindAsync( filters.And( filters.Eq("UserId", user.Id), filters.Gte("Begin", DateTime.Now) ) ); var meetings = await results.ToListAsync(); if (meetings != null) { return(Ok(meetings)); } return(Ok(new List <MeetingSchedule>())); } catch (Exception e) { return(InternalServerError(e)); } }
public async Task <IHttpActionResult> GetNotifications(string Id) { if (Id == null) { return(NotFound()); } var db = IlevusDBContext.Create(); var builder = Builders <NotificationModel> .Filter; var filters = (builder.Eq("User_id", Id) | builder.Eq("User_id", "0")); var collection = db.GetNotificationsCollection(); try { var results = await collection.FindAsync(filters); var notifications = await results.ToListAsync(); if (notifications != null) { return(Ok(notifications)); } return(Ok(new List <NotificationModel>())); } catch (Exception e) { return(InternalServerError(e)); } }
public async Task <IHttpActionResult> CatchModerationAd(string Id, string Status) { var db = IlevusDBContext.Create(); var filters = Builders <Ad> .Filter; var updates = Builders <Ad> .Update; var collection = db.GetAdsCollection(); try { var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); var Moderator = new UserModerator() { AnalysisHour = DateTime.Now, Email = user.Email, Id = user.Id }; var result = await collection.UpdateOneAsync( filters.Eq("Id", Id), updates.Combine( updates.Set("Status", Status), updates.Set("Moderator", Moderator) ) ); return(Ok()); } catch (Exception e) { return(InternalServerError(e)); } }
public async Task <IHttpActionResult> GetMeetings(string UserId, DateTime From, DateTime To) { var db = IlevusDBContext.Create(); var filters = Builders <MeetingSchedule> .Filter; var collection = db.GetMeetingScheduleCollection(); try { var results = await collection.FindAsync( filters.And( filters.Eq("UserId", UserId), filters.Gte("Begin", From), filters.Lte("Begin", To) ) ); var meetings = await results.ToListAsync(); if (meetings != null) { return(Ok(meetings)); } return(Ok(new List <MeetingSchedule>())); } catch (Exception e) { return(InternalServerError(e)); } }
public async Task <IHttpActionResult> SetReadyNotification(string Id) { var db = IlevusDBContext.Create(); var filters = Builders <NotificationModel> .Filter; var updates = Builders <NotificationModel> .Update; var collection = db.GetNotificationsCollection(); try { var result = await collection.FindAsync(filters.Eq("Id", Id)); var notification = await result.FirstOrDefaultAsync(); if (notification == null) { return(NotFound()); } await collection.UpdateOneAsync( filters.Eq("Id", Id), updates.Set("Status", !notification.Status) ); return(await GetNotifications(notification.User_id)); } catch (Exception e) { return(InternalServerError(e)); } }
public async Task <IHttpActionResult> PollContacts(DateTime Since) { var db = IlevusDBContext.Create(); var filters = Builders <ChatConversation> .Filter; var user = UserManager.FindByName(User.Identity.Name); var collection = db.GetConversationsCollection(); try { var results = await collection.FindAsync( filters.Or( filters.Eq("FirstUser", user.Id), filters.Eq("SecondUser", user.Id) ) ); var conversations = await results.ToListAsync(); if (conversations != null) { return(Ok(new ChatContactsViewModel(conversations, user.Id, db.GetUsersCollection()))); } return(BadRequest("Invalid conversation")); } catch (Exception e) { return(InternalServerError(e)); } }
public async Task <IHttpActionResult> GetCoacheeProcesses() { var db = IlevusDBContext.Create(); var filters = Builders <CoachingProcess> .Filter; var collection = db.GetCoachingProcessCollection(); try { var user = await UserManager.FindByNameAsync(User.Identity.Name); var results = await collection.FindAsync(filters.Eq("CoacheeId", user.Id)); var processes = await results.ToListAsync(); if (processes != null) { var viewModels = new List <CoachingProcessViewModel>(); foreach (var process in processes) { var coach = await UserManager.FindByIdAsync(process.CoachId); viewModels.Add(new CoachingProcessViewModel(process, coach, user)); } return(Ok(viewModels)); } return(Ok(new List <CoachingProcess>())); } catch (Exception e) { return(InternalServerError(e)); } }
public async Task <IHttpActionResult> HireCoach(string Id) { var db = IlevusDBContext.Create(); var collection = db.GetCoachingProcessCollection(); try { var user = await UserManager.FindByNameAsync(User.Identity.Name); var coach = await UserManager.FindByIdAsync(Id); var process = new CoachingProcess() { CoachId = coach.Id, CoacheeId = user.Id }; process.Steps = coach.Professional.ProcessSteps; await collection.InsertOneAsync(process); return(Ok(process)); } catch (Exception e) { return(InternalServerError(e)); } }
public override void Up() { InsertField("Campaign", ""); //var collection = GetCollection(IlevusTableNames.AdsTable); var db = IlevusDBContext.Create(); var filters = Builders <Ad> .Filter; var Ads = db.GetAdsCollection(); var results = Ads.Find(filters.Empty); var ads = results.ToList(); if (ads != null) { foreach (var item in ads) { var updates = Builders <Ad> .Update; Ads.UpdateOneAsync( filters.Eq("Id", item.Id), updates.Combine( updates.Set("Campaign", item.Headline) ) ); } } }
public async Task <IHttpActionResult> ClickAd(string Id) { var db = IlevusDBContext.Create(); var filters = Builders <Ad> .Filter; var updates = Builders <Ad> .Update; var collection = db.GetAdsCollection(); var collectionReport = db.GetAdsReport(); var cBalance = db.GetAdsBalanceCollection(); var filtersBalance = Builders <AdBalance> .Filter; var updatesBalance = Builders <AdBalance> .Update; try { var rBalance = cBalance.Find(filtersBalance.Empty); var balance = rBalance.FirstOrDefault(); var _idBalance = balance.Id; var result = await collection.FindAsync(filters.Eq("Id", Id)); var ad = await result.FirstOrDefaultAsync(); if (ad == null) { return(NotFound()); } collection.UpdateOneAsync( filters.Eq("Id", Id), updates.Inc("Hits", 1) ); JToken token = JObject.Parse(IlevusDBContext.SystemDefinitions.definitions); CultureInfo culture = Thread.CurrentThread.CurrentCulture; var implemented = CultureHelper.GetImplementedCulture(culture.Name).Replace("-", "_"); cBalance.UpdateOne( filtersBalance.Eq("Id", _idBalance), updatesBalance.Set("Balance", balance.Balance - Convert.ToDouble(token.SelectToken("CostPerClick_" + implemented))) ); AdsReport adReport = new AdsReport() { ad_event = "click", ad_id = Id, cost = Convert.ToDouble(token.SelectToken("CostPerClick_" + implemented)), date = DateTime.Now }; collectionReport.InsertOne(adReport); return(Redirect(ad.Link)); } catch (Exception e) { return(InternalServerError(e)); } }
public async Task <IHttpActionResult> UpdateAccountBlockingEmail(SystemTranslatedEmail model) { IlevusDBContext.SystemConfiguration.AccountBlockingMessages = model; if (await IlevusDBContext.Create().UpdateSystemConfig()) { return(Ok(IlevusDBContext.SystemConfiguration)); } return(BadRequest()); }
public async Task <IHttpActionResult> UpdateRecoverPasswordEmail(SystemTranslatedEmail model) { IlevusDBContext.SystemConfiguration.RecoverPasswordMessages = model; if (await IlevusDBContext.Create().UpdateSystemConfig()) { return(Ok(IlevusDBContext.SystemConfiguration)); } return(BadRequest()); }
private static IlevusUser RetrieveUserByService(Guid serviceId) { IlevusDBContext db = IlevusDBContext.Create(); return(db.GetUsersCollection() .Find(x => x.Professional.Services .Any(y => y.Id == serviceId)) .FirstOrDefault()); }
public async Task <IHttpActionResult> UpdateMessage(MessageBindingModel model) { var db = IlevusDBContext.Create(); if (!await db.UpdateSystemMessage(model)) { return(BadRequest("Something happenned...")); } return(Ok("Message updated successfully.")); }
public async Task <IHttpActionResult> CountPreviewsModerationAds() { var db = IlevusDBContext.Create(); var filters = Builders <AdLogModeration> .Filter; var countModerations = new CountPreviewModeration(); var collection = db.GetAdsLogCollection(); try { var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); //Somatório Dia var dtStart = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 0, 0, 0); var dtEnd = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 23, 59, 59); var result = collection.Find( filters.And( filters.Eq("user_id", user.Id), filters.Gte("date", dtStart), filters.Lte("date", dtEnd) ) ); countModerations.dailyCount = Convert.ToInt32(result.Count()); //Somatório Mês dtStart = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1, 0, 0, 0); dtEnd = new DateTime(DateTime.Today.Year, DateTime.Today.Month, dtStart.AddMonths(1).AddDays(-1).Day, 23, 59, 59); result = collection.Find( filters.And( filters.Eq("user_id", user.Id), filters.Gte("date", dtStart), filters.Lte("date", dtEnd) ) ); countModerations.monthCount = Convert.ToInt32(result.Count()); //Somatório Mês Anterior dtStart = new DateTime(DateTime.Today.Year, DateTime.Today.AddMonths(-1).Month, 1, 0, 0, 0); dtEnd = new DateTime(DateTime.Today.Year, dtStart.Month, dtStart.AddMonths(1).AddDays(-1).Day, 23, 59, 59); result = collection.Find( filters.And( filters.Eq("user_id", user.Id), filters.Gte("date", dtStart), filters.Lte("date", dtEnd) ) ); countModerations.prevMonthCount = Convert.ToInt32(result.Count()); return(Ok(countModerations)); } catch (Exception e) { return(InternalServerError(e)); } }
public async Task <IHttpActionResult> SaveModerationAd(string Id, string Status) { var db = IlevusDBContext.Create(); var filters = Builders <Ad> .Filter; var updates = Builders <Ad> .Update; var collection = db.GetAdsCollection(); try { var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); /*var Moderator = new UserModerator() * { * AnalysisHour = DateTime.Now, * Email = user.Email, * Id = user.Id * };*/ var result = await collection.UpdateOneAsync( filters.Eq("Id", Id), updates.Combine( updates.Set("Status", Status), updates.Set("Moderator", new UserModerator() { AnalysisHour = null, Email = "", Id = "" }) ) ); //Adicionar Log var collectionLog = db.GetAdsLogCollection(); AdLogModeration adLog = new AdLogModeration() { user_id = user.Id, user_nome = user.Name, user_email = user.Email, ad_id = Id, status = Status, date = DateTime.Now }; await collectionLog.InsertOneAsync(adLog); return(Ok(true)); } catch (Exception e) { return(InternalServerError(e)); } }
public async Task <IHttpActionResult> UpdateSessionField(CoachingSessionFieldUpdateBindingModel model) { var db = IlevusDBContext.Create(); var filters = Builders <CoachingProcess> .Filter; var updates = Builders <CoachingProcess> .Update; var collection = db.GetCoachingProcessCollection(); try { var process = (await collection.FindAsync(filters.Eq("Id", model.ProcessId))).FirstOrDefault(); if (process != null) { var session = process.Sessions[model.Session]; if ("Objectives".Equals(model.Field)) { session.Objectives = model.Value; } else if ("CoachComments".Equals(model.Field)) { session.CoachComments = model.Value; } else if ("CoacheeComments".Equals(model.Field)) { session.CoacheeComments = model.Value; } else { return(BadRequest("Invalid request")); } process.LastModified = DateTime.Now; await collection.UpdateOneAsync(filters.Eq("Id", model.ProcessId), updates.Combine( updates.Set("Sessions", process.Sessions), updates.Set("LastModified", process.LastModified) ) ); var coachee = await UserManager.FindByIdAsync(process.CoacheeId); var coach = await UserManager.FindByIdAsync(process.CoachId); return(Ok(new CoachingProcessViewModel(process, coach, coachee))); } return(NotFound()); } catch (Exception e) { return(InternalServerError(e)); } }
public async Task <IHttpActionResult> GetCoachingProcess(string id, string lastModified = null) { var db = IlevusDBContext.Create(); var filters = Builders <CoachingProcess> .Filter; var updates = Builders <CoachingProcess> .Update; var collection = db.GetCoachingProcessCollection(); try { if (!string.IsNullOrEmpty(lastModified)) { var modified = await collection.CountAsync(filters.And( filters.Eq("Id", id), filters.Gt("LastModified", DateTime.Parse(lastModified)) )); if (modified == 0) { return(Ok(false)); } } var process = (await collection.FindAsync(filters.Eq("Id", id))).FirstOrDefault(); if (process != null) { var coachee = await UserManager.FindByIdAsync(process.CoacheeId); var coach = await UserManager.FindByIdAsync(process.CoachId); if (process.Sessions.Count == 0) { var session = new CoachingSession(); await collection.UpdateOneAsync(filters.Eq("Id", id), updates.Push("Sessions", session)); process.Sessions.Add(session); } if (process.Steps == null || process.Steps.Count == 0) { await collection.UpdateOneAsync(filters.Eq("Id", id), updates.Set("Steps", coach.Professional.ProcessSteps)); process.Steps = coach.Professional.ProcessSteps; } return(Ok(new CoachingProcessViewModel(process, coach, coachee))); } return(NotFound()); } catch (Exception e) { return(InternalServerError(e)); } }
public async Task <IHttpActionResult> UpdateApisConfigs(SystemApisConfigsBindingModel model) { IlevusDBContext.SystemConfiguration.MoipBaseUrl = model.MoipBaseUrl; IlevusDBContext.SystemConfiguration.MoipToken = model.MoipToken; IlevusDBContext.SystemConfiguration.MoipKey = model.MoipKey; IlevusDBContext.SystemConfiguration.MoipSubscriptionKey = model.MoipSubscriptionKey; IlevusDBContext.SystemConfiguration.MoipSubscriptionCode = model.MoipSubscriptionCode; IlevusDBContext.SystemConfiguration.MoipCryptoPublicKey = model.MoipCryptoPublicKey; if (await IlevusDBContext.Create().UpdateSystemConfig()) { return(Ok(IlevusDBContext.SystemConfiguration)); } return(BadRequest()); }
public IEnumerable Get() { IlevusDBContext repository = IlevusDBContext.Create(); //User.Identity.Name IlevusUser user = UserManager.FindByName(User.Identity.Name); if (user.AccountCustumer == null) { return(null); } var lista = MongoContext.Current.Find <PaymentsCustomer>(x => x.Customer.Id == user.AccountCustumer.Id); return(lista.ToList()); }
public async Task <IHttpActionResult> GetModerationsAds() { var db = IlevusDBContext.Create(); var filters = Builders <Ad> .Filter; var collection = db.GetAdsCollection(); try { //var directed = collection.Find( var ads = collection.Find( filters.And( filters.Eq("Active", true), filters.Not( filters.Or( filters.Eq("Status", Enums.ModerationAds.Approved), filters.Eq("Status", Enums.ModerationAds.Denied) ) ), filters.Or( filters.Eq("Status", Enums.ModerationAds.WaitingAnalysis), filters.And( filters.Eq("Status", Enums.ModerationAds.OnAnalysing), filters.Lt("Moderator.AnalysisHour", DateTime.Now.AddMinutes(-5)) ) ) ) ).FirstOrDefault(); //var ads = await directed.ToListAsync(); if (ads != null) { await this.CatchModerationAd(ads.Id, Enums.ModerationAds.OnAnalysing); return(Ok(ads)); } //return Ok(new List<Ad>()); return(Ok(false)); } catch (Exception e) { return(InternalServerError(e)); } }
public async Task <IHttpActionResult> BookMeeting(MeetingBindingModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var collection = IlevusDBContext.Create().GetMeetingScheduleCollection(); try { var meeting = new MeetingSchedule() { UserId = model.UserId, CoacheeEmail = model.CoacheeEmail, CoacheeFullName = model.CoacheeFullName, CoacheePhone = model.CoacheePhone, Subject = model.Subject, Begin = model.Begin }; await collection.InsertOneAsync(meeting); try { NotificationsController notC = new NotificationsController(); await notC.SendNotification(new NotificationModel() { DateNotification = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"), From = model.CoacheeEmail, InfoNotification = model.Subject, Status = false, Subject = "Agendamento de reunião", User_id = model.UserId }); } catch (Exception ex) { Console.WriteLine(ex.Message); } return(Ok(meeting)); } catch (Exception e) { return(InternalServerError(e)); } }
public async Task <IHttpActionResult> GetReceivedAssessment(string Id) { var db = IlevusDBContext.Create(); var filters = Builders <AssessmentModel> .Filter; var collection = db.GeAssessmentsCollection(); var collectionUser = db.GetUsersCollection(); var filtersUsers = Builders <IlevusUser> .Filter; try { var idBusca = Id; if (!System.Text.RegularExpressions.Regex.IsMatch(idBusca, @"\A\b[0-9a-fA-F]+\b\Z")) { var builder = Builders <IlevusUser> .Filter; var filtersUser = builder.Eq("Professional.NomeURL", idBusca); var results = await collectionUser.FindAsync(filtersUser); var users = await results.ToListAsync(); if (users.Count > 0) { idBusca = users[0].Id; } } var result = await collection.FindAsync(filters.Eq("Avaliado", idBusca)); var avaliacoes = await result.ToListAsync(); if (avaliacoes == null) { return(NotFound()); } avaliacoes = await fillUsers(avaliacoes); avaliacoes = calculaMedia(avaliacoes); return(Ok(avaliacoes)); } catch (Exception e) { return(InternalServerError(e)); } }
public async Task <IHttpActionResult> StartSession(string id) { var db = IlevusDBContext.Create(); var filters = Builders <CoachingProcess> .Filter; var updates = Builders <CoachingProcess> .Update; var collection = db.GetCoachingProcessCollection(); try { var user = await UserManager.FindByNameAsync(User.Identity.Name); var process = (await collection.FindAsync(filters.Eq("Id", id))).FirstOrDefault(); if (process != null) { var session = process.Sessions[process.Sessions.Count - 1]; if (session.Status != 0 || !process.CoachId.Equals(user.Id)) { return(BadRequest("Você não pode iniciar esta sessão.")); } session.Status = 5; session.Started = DateTime.Now; process.LastModified = session.Started; await collection.UpdateOneAsync(filters.Eq("Id", id), updates.Combine( updates.Set("Sessions", process.Sessions), updates.Set("Status", 5), updates.Set("LastModified", process.LastModified) ) ); var coachee = await UserManager.FindByIdAsync(process.CoacheeId); var coach = await UserManager.FindByIdAsync(process.CoachId); return(Ok(new CoachingProcessViewModel(process, coach, coachee))); } return(NotFound()); } catch (Exception e) { return(InternalServerError(e)); } }
public async Task <IHttpActionResult> NewSession(string id) { var db = IlevusDBContext.Create(); var filters = Builders <CoachingProcess> .Filter; var updates = Builders <CoachingProcess> .Update; var collection = db.GetCoachingProcessCollection(); try { var user = await UserManager.FindByNameAsync(User.Identity.Name); var process = (await collection.FindAsync(filters.Eq("Id", id))).FirstOrDefault(); if (process != null) { var session = process.Sessions[process.Sessions.Count - 1]; if (session.Status < 10 || !process.CoachId.Equals(user.Id)) { return(BadRequest("Você não pode criar uma nova sessão antes de finalizar a atual.")); } var newSession = new CoachingSession(); process.Sessions.Add(newSession); process.LastModified = newSession.Creation; await collection.UpdateOneAsync(filters.Eq("Id", id), updates.Combine( updates.AddToSet("Sessions", newSession), updates.Set("LastModified", newSession.Creation) ) ); var coachee = await UserManager.FindByIdAsync(process.CoacheeId); var coach = await UserManager.FindByIdAsync(process.CoachId); return(Ok(new CoachingProcessViewModel(process, coach, coachee))); } return(NotFound()); } catch (Exception e) { return(InternalServerError(e)); } }
public async Task <IHttpActionResult> EnsureConversation(string Destination) { if (string.IsNullOrWhiteSpace(Destination)) { return(BadRequest("You must provide a destination id.")); } var filters = Builders <ChatConversation> .Filter; var user = UserManager.FindByName(User.Identity.Name); var partner = await UserManager.FindByIdAsync(Destination); var collection = IlevusDBContext.Create().GetConversationsCollection(); var first = string.Compare(partner.Id, user.Id) > 0 ? user : partner; var second = string.Compare(partner.Id, user.Id) < 0 ? user : partner; try { var results = await collection.FindAsync( filters.And( filters.Eq("FirstUser", first.Id), filters.Eq("SecondUser", second.Id) ) ); var conversation = await results.FirstOrDefaultAsync(); if (conversation != null) { return(Ok(new ChatConversationViewModel(conversation, partner))); } conversation = new ChatConversation() { FirstUser = first.Id, SecondUser = second.Id }; await collection.InsertOneAsync(conversation); return(Ok(new ChatConversationViewModel(conversation, partner))); } catch (Exception e) { return(InternalServerError(e)); } }
public async Task <IHttpActionResult> InitializeTool(CoachingSessionBindingModel model) { var db = IlevusDBContext.Create(); var filters = Builders <CoachingProcess> .Filter; var updates = Builders <CoachingProcess> .Update; var collection = db.GetCoachingProcessCollection(); try { var process = (await collection.FindAsync(filters.Eq("Id", model.ProcessId))).FirstOrDefault(); if (process != null) { var session = process.Sessions[model.Session]; if (session == null) { return(BadRequest("Sessão inválida.")); } var coachee = await UserManager.FindByIdAsync(process.CoacheeId); var coach = await UserManager.FindByIdAsync(process.CoachId); if (session.WheelOfLifeTool == null) { session.WheelOfLifeTool = new WheelOfLife(coach.Professional.CoachingToolsConfigs.WheelOfLifeDefaults); } process.LastModified = DateTime.Now; await collection.UpdateOneAsync(filters.Eq("Id", model.ProcessId), updates.Combine( updates.Set("Sessions", process.Sessions), updates.Set("LastModified", process.LastModified) ) ); return(Ok(session.WheelOfLifeTool)); } return(NotFound()); } catch (Exception e) { return(InternalServerError(e)); } }
public async Task <IHttpActionResult> SyncMessages([FromBody] string UrlPrefix) { var client = new HttpClient(); var response = await client.GetAsync(UrlPrefix + "/api/System/Messages/Sync?k=" + SYNC_KEY); var responseString = await response.Content.ReadAsStringAsync(); IDictionary <string, SystemMessages> data = JsonConvert.DeserializeObject <IDictionary <string, SystemMessages> >(responseString); long processed = 0; try { processed = await IlevusDBContext.Create().SyncMessages(data); } catch (Exception ex) { return(BadRequest(ex.Message)); } return(Ok(processed)); }