public static void RecordTimeline(ITimelineService service, BrowsingHistory browsingHistory) { if (service.VerifyRationality(browsingHistory)) { service.Insert(browsingHistory); } }
public IHttpActionResult Post(TimelinePostModel model) { if (!ModelState.IsValid) { return(Response(new { Success = false, Message = "Invalid data" })); } //TODO: check OwnerId for valid values and store entity name accordingly, these can be customer, artist page, videobattle page etc. model.OwnerId = _workContext.CurrentCustomer.Id; model.OwnerEntityType = TimelinePostOwnerTypeNames.Customer; //create new timeline post var post = new TimelinePost() { Message = model.Message, AdditionalAttributeValue = model.AdditionalAttributeValue, PostTypeName = model.PostTypeName, DateCreated = DateTime.UtcNow, DateUpdated = DateTime.UtcNow, OwnerId = model.OwnerId, IsSponsored = model.IsSponsored, OwnerEntityType = model.OwnerEntityType, LinkedToEntityName = model.LinkedToEntityName, LinkedToEntityId = model.LinkedToEntityId, PublishDate = model.PublishDate }; //save it _timelineService.Insert(post); var postModel = PrepareTimelinePostDisplayModel(post); return(Response(new { Success = true, Post = postModel })); }
public void Publish <T>(T entity, string postTypeName, int ownerId) where T : BaseEntity { //create new timeline post var post = new TimelinePost() { Message = string.Empty, AdditionalAttributeValue = string.Empty, PostTypeName = postTypeName, DateCreated = DateTime.UtcNow, DateUpdated = DateTime.UtcNow, OwnerId = ownerId, IsSponsored = false, OwnerEntityType = TimelinePostOwnerTypeNames.Customer, LinkedToEntityName = typeof(T).Name, LinkedToEntityId = entity.Id, PublishDate = DateTime.UtcNow }; //save the post _timelineService.Insert(post); }
public static void RecordTimeline <T>(ITimelineService <T> service, T entity) { if (service.Verify(entity)) { Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() => service.Insert(entity))); } }