Beispiel #1
0
        public Item UpdateItem(Item changedItem)
        {
            Item item = ctx.Items.Find(changedItem.ItemId);

            if (item.Name != changedItem.Name)
            {
                item.Name = changedItem.Name;
            }
            if (changedItem.GetType().ToString().Contains("Person"))
            {
                if (((Person)item).Organization != ((Person)changedItem).Organization)
                {
                    ((Person)item).Organization = ((Person)changedItem).Organization;
                }
                if (((Person)changedItem).SocialMediaProfiles.Count != 0)
                {
                    ((Person)item).SocialMediaProfiles = ((Person)changedItem).SocialMediaProfiles;
                }
            }
            if (changedItem.GetType().ToString().Contains("Organization"))
            {
                if (((Organization)changedItem).SocialMediaProfiles.Count != 0)
                {
                    ((Organization)item).SocialMediaProfiles = ((Organization)changedItem).SocialMediaProfiles;
                }
                ((Organization)item).Persons = ((Organization)changedItem).Persons;
            }
            if (changedItem.GetType().ToString().Contains("Theme"))
            {
                ((Theme)item).Keywords = ((Theme)changedItem).Keywords;
            }
            ctx.Entry(item).State = System.Data.Entity.EntityState.Modified;
            ctx.SaveChanges();
            return(item);
        }
 public void AddPostToItems(SocialMediaPost post)
 {
     foreach (var person in post.Persons)
     {
         person.SocialMediaPosts.Add(post);
         ctx.Entry(person).State = System.Data.Entity.EntityState.Modified;
     }
     foreach (var theme in post.Themes)
     {
         theme.SocialMediaPosts.Add(post);
         ctx.Entry(theme).State = System.Data.Entity.EntityState.Modified;
     }
     ctx.SaveChanges();
 }
 public void UpdateZone(Zone zone)
 {
     ctx.Entry(zone).State = System.Data.Entity.EntityState.Modified;
     ctx.SaveChanges();
 }
 public void UpdateChartItemData(ChartItemData chartItemData)
 {
     ctx.Entry(chartItemData).State = System.Data.Entity.EntityState.Modified;
     ctx.SaveChanges();
 }
Beispiel #5
0
 /// <summary>
 /// Update a specific subscription.
 /// Returns -1 if SaveChanges() is delayed by unit of work.
 /// </summary>
 public int UpdateSubScription(Subscription sub)
 {
     ctx.Entry(sub).State = EntityState.Modified;
     return(ctx.SaveChanges());
 }
Beispiel #6
0
 /// <summary>
 /// Updates an audit and persists that to the database
 /// </summary>
 public int UpdateAudit(SynchronizeAudit audit)
 {
     ctx.Entry(audit).State = EntityState.Modified;
     return(ctx.SaveChanges());
 }
 public void UpdatePlatform(Platform p)
 {
     ctx.Entry(p).State = EntityState.Modified;
     ctx.SaveChanges();
 }
 /// <summary>;
 /// Updates a given user
 /// Returns -1 if SaveChanges() is delayed by unit of work.
 /// </summary>
 public int UpdateUser(User user)
 {
     ctx.Entry(user).State = EntityState.Modified;
     return(ctx.SaveChanges());
 }
Beispiel #9
0
 public void UpdateAlert(Alert alert)
 {
     ctx.Entry(alert).State = System.Data.Entity.EntityState.Modified;
     ctx.SaveChanges();
 }
Beispiel #10
0
 /// <summary>
 /// Updates an item and persists changes to the database
 /// Returns -1 if SaveChanges() is delayed by unit of work.
 /// </summary>
 public int UpdateItem(Item item)
 {
     ctx.Entry(item).State = EntityState.Modified;
     return(ctx.SaveChanges());
 }
 public void UpdateUser(ApplicationUser user)
 {
     ctx.Entry(user).State = System.Data.Entity.EntityState.Modified;
     ctx.SaveChanges();
 }
 /// <summary>
 /// Updates a single subplatform.
 /// </summary>
 public int UpdateSubplatform(SubPlatform subPlatform)
 {
     ctx.Entry(subPlatform).State = EntityState.Modified;
     return(ctx.SaveChanges());
 }
Beispiel #13
0
 /// <summary>
 /// Updates a specific widget.
 /// Returns -1 if SaveChanges() is delayed by unit of work.
 /// </summary>
 public int UpdateWidget(Widget widget)
 {
     ctx.Entry(widget).State = EntityState.Modified;
     return(ctx.SaveChanges());
 }