public static PomodoroItemModel FromEntityToModel(PomodoroItem pomodoroItem)
        {
            var retVal = new PomodoroItemModel
            {
                DateTimeInUtc         = pomodoroItem.DateTimeInUtc,
                Aborted               = pomodoroItem.Aborted,
                LengthInSec           = pomodoroItem.LengthInSec,
                NumberOfInterruptions = pomodoroItem.NumberOfInterruptions,
                Id = pomodoroItem.Id
            };

            if (pomodoroItem.ToDoItem != null)
            {
                retVal.ToDoItemGuid = pomodoroItem.ToDoItem.Id;
            }

            return(retVal);
        }
示例#2
0
        /// <summary>
        /// Just for testing! Fills in memory db context
        /// </summary>
        public static void FillInMemoryDbContext(ToDoDbContext toDoDbContext)
        {
            var newTodo1 = new ToDoItem()
            {
                Created     = DateTime.Now.AddMinutes(-353),
                Description = "Do what you have to do",
                Title       = "Code new feature - in memory test",
                Id          = Guid.NewGuid()
            };

            var todo1Entity = toDoDbContext.ToDoItems.Add(newTodo1);

            var pomodoroItem = new PomodoroItem
            {
                DateTimeInUtc = DateTime.Now.AddMinutes(-12),
                ToDoItem      = todo1Entity.Entity,
                LengthInSec   = 15 * 60,
            };

            toDoDbContext.PomodoroItems.Add(pomodoroItem);
            toDoDbContext.SaveChanges();

            int aa = toDoDbContext.ToDoItems.ToList().Count;
        }