internal static void Map(FeedData source, Feed destination) { destination.FeedId = source.FeedId; destination.Action = source.Action; destination.Description = source.Description; destination.SourceId = source.SourceId; destination.SourceTypeId = source.SourceTypeId; destination.CreatedBy = source.CreatedBy; destination.CreatedDate = source.CreatedDate; }
public FeedData Insert(FeedData data) { using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities> .GetManager(Database.ApplicationConnection, false)) { var feed = new Feed(); DataMapper.Map(data, feed); ctx.ObjectContext.AddToFeeds(feed); ctx.ObjectContext.SaveChanges(); data.FeedId = feed.FeedId; return data; } }
private void Fetch(Feed feed, FeedData feedData) { DataMapper.Map(feed, feedData); feedData.Source = new SourceData(); DataMapper.Map(feed.Source, feedData.Source); feedData.CreatedByUser = new UserData(); DataMapper.Map(feed.CreatedByUser, feedData.CreatedByUser); foreach (var feedSourceMember in feed.FeedSourceMembers) { var feedSourceMemberData = new FeedSourceMemberData(); DataMapper.Map(feedSourceMember, feedSourceMemberData); var sourceData = new SourceData(); DataMapper.Map(feedSourceMember.Source, sourceData); feedSourceMemberData.Source = sourceData; feedData.Sources.Add(feedSourceMemberData); } }
public FeedData Update(FeedData data) { using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities> .GetManager(Database.ApplicationConnection, false)) { var feed = new Feed { FeedId = data.FeedId }; ctx.ObjectContext.Feeds.Attach(feed); DataMapper.Map(data, feed); ctx.ObjectContext.SaveChanges(); return data; } }
/// <summary> /// Create a new Feed object. /// </summary> /// <param name="feedId">Initial value of the FeedId property.</param> /// <param name="action">Initial value of the Action property.</param> /// <param name="description">Initial value of the Description property.</param> /// <param name="sourceId">Initial value of the SourceId property.</param> /// <param name="sourceTypeId">Initial value of the SourceTypeId property.</param> /// <param name="createdBy">Initial value of the CreatedBy property.</param> /// <param name="createdDate">Initial value of the CreatedDate property.</param> public static Feed CreateFeed(global::System.Int32 feedId, global::System.String action, global::System.String description, global::System.Int32 sourceId, global::System.Int32 sourceTypeId, global::System.Int32 createdBy, global::System.DateTime createdDate) { Feed feed = new Feed(); feed.FeedId = feedId; feed.Action = action; feed.Description = description; feed.SourceId = sourceId; feed.SourceTypeId = sourceTypeId; feed.CreatedBy = createdBy; feed.CreatedDate = createdDate; return feed; }
/// <summary> /// Deprecated Method for adding a new object to the Feeds EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToFeeds(Feed feed) { base.AddObject("Feeds", feed); }