public SocialMediaPost CreateSocialMediaPost(SocialMediaPost socialMediaPost)
 {
     if (!ctx.SocialMediaPosts.Any(s => s.PostId == socialMediaPost.PostId))
     {
         ctx.SocialMediaPosts.Add(socialMediaPost);
         ctx.SaveChanges();
         return(socialMediaPost);
     }
     else
     {
         return(null);
     }
 }
 public Zone CreateZone(Zone zone)
 {
     ctx.Zones.Add(zone);
     ctx.SaveChanges();
     return(zone);
 }
Exemple #3
0
 public Settings CreateSettings(Settings settings)
 {
     ctx.Settings.Add(settings);
     ctx.SaveChanges();
     return(settings);
 }
 public ChartItemData CreateChartItemData(ChartItemData chartItemData)
 {
     ctx.ChartItemDatas.Add(chartItemData);
     ctx.SaveChanges();
     return(chartItemData);
 }
Exemple #5
0
 /// <summary>
 /// Creates a new instance of an information objects and
 /// persists it to the database.
 /// Returns -1 if SaveChanges() is delayed by unit of work.
 /// </summary>
 public int CreateInformations(IEnumerable <Information> infos)
 {
     ctx.Configuration.AutoDetectChangesEnabled = false;
     ctx.Informations.AddRange(infos);
     return(ctx.SaveChanges());
 }
Exemple #6
0
 public Item CreateItem(Item item)
 {
     ctx.Items.Add(item);
     ctx.SaveChanges();
     return(item);
 }
 /// <summary>
 /// Creates an instance of a user in the database.
 /// Returns -1 if SaveChanges() is delayed by unit of work.
 /// </summary>
 public int CreateUser(User user)
 {
     ctx.Users.Add(user);
     return(ctx.SaveChanges());
 }
Exemple #8
0
 /// <summary>
 /// Creates a new subscription and persist that
 /// subscription to the database.
 /// Returns -1 if SaveChanges() is delayed by unit of work.
 /// </summary>
 public int CreateSubscription(Subscription sub)
 {
     ctx.Subscriptions.Add(sub);
     return(ctx.SaveChanges());
 }
Exemple #9
0
 public Alert CreateAlert(Alert alert)
 {
     ctx.Alerts.Add(alert);
     ctx.SaveChanges();
     return(alert);
 }
 public Platform CreatePlatform(Platform p)
 {
     ctx.Platforms.Add(p);
     ctx.SaveChanges();
     return(p);
 }
Exemple #11
0
 /// <summary>
 /// Persists an item to the database.
 /// Returns -1 if SaveChanges() is delayed by unit of work.
 /// </summary>
 public int CreateItem(Item item)
 {
     ctx.Items.Add(item);
     return(ctx.SaveChanges());
 }
 public ApplicationUser CreateUser(ApplicationUser user)
 {
     ctx.Users.Add(user);
     ctx.SaveChanges();
     return(user);
 }
 public Chart CreateChart(Chart chart)
 {
     ctx.Charts.Add(chart);
     ctx.SaveChanges();
     return(chart);
 }
 /// <summary>
 /// Creates a new instance of a given subplatform in the database
 /// </summary>
 public int CreateSubplatform(SubPlatform subPlatform)
 {
     ctx.SubPlatforms.Add(subPlatform);
     return(ctx.SaveChanges());
 }
Exemple #15
0
 /// <summary>
 /// Creates a new dashboard and persist that
 /// to the database.
 /// Returns -1 if SaveChanges() is delayed by unit of work.
 /// </summary>
 public int CreateDashboard(Dashboard dashboard)
 {
     ctx.Dashboards.Add(dashboard);
     return(ctx.SaveChanges());
 }