public QueueEventLogDTO Add(QueueEventLogDTO item) { using (Entities context = new Entities()) { QueueEventLog addedItem = context.QueueEventLogs.Add( new QueueEventLog { Message = item.Message, QueueEventCreated = item.QueueEventCreated, QueueEventId = item.QueueEventId, BadgeAwardId = item.BadgeAwardId }); context.SaveChanges(); return new QueueEventLogDTO { Message = addedItem.Message, QueueEventCreated = addedItem.QueueEventCreated, QueueEventId = addedItem.QueueEventId, QueueEventLogId = addedItem.QueueEventLogId, BadgeAwardId = addedItem.BadgeAwardId }; } }
public void RegisterQueueItemProgress(QueueEventType eventType, QueueItemDTO latestItem) { QueueEventLogDTO eventLogItem = new QueueEventLogDTO { Message = string.Format("Queue Data Item {0} is {1}", latestItem.BadgeAwardId, eventType.ToString()), QueueEventCreated = DateTime.Now, QueueEventId = (int)eventType, BadgeAwardId = latestItem.BadgeAwardId }; _queueEventLogDAL.Add(eventLogItem); }
private static QueueEventLogDTO AddQueueEventLogRecord(IQueueEventLogDAL queueEventLogDAL, IQueueItemDAL queueItemDAL) { //Grab the top item QueueItemDTO queueItemDTO = queueItemDAL.Peek(); Assert.IsNotNull(queueItemDTO); QueueEventLogDTO queueEventLogItem = new QueueEventLogDTO { Message = "Test Message", QueueEventCreated = DateTime.Now, QueueEventId = 1, BadgeAwardId = queueItemDTO.QueueItemId }; QueueEventLogDTO addedItem = queueEventLogDAL.Add(queueEventLogItem); return addedItem; }
public QueueEventLogDTO Update(QueueEventLogDTO item) { using (Entities context = new Entities()) { QueueEventLog itemToUpdate = new QueueEventLog { Message = item.Message, QueueEventCreated = item.QueueEventCreated, QueueEventId = item.QueueEventId, QueueEventLogId = item.QueueEventLogId, BadgeAwardId = item.BadgeAwardId }; context.QueueEventLogs.Attach(itemToUpdate); context.Entry(itemToUpdate).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); return Get(item.QueueEventLogId); } }