示例#1
0
        public void Handle(CreateSessionCommand command)
        {
            Session session = new Session()
            {
                Name = command.Name,
                StartTime = command.StartTime,
                Length = command.Length,
                Project = command.Project,
                Definition = command.Definition
            };

            _context.Sessions.Add(session);
            _context.SaveChanges();
            command.NewId = session.Id;

        }
示例#2
0
        public void Handle(CreateProjectCommand command)
        {
            Project project = new Project()
            {
                Name        = command.Name,
                Description = command.Description ?? String.Empty,
                SessionDefinitionTemplate = command.SessionDefinitionTemplate ?? String.Empty
            };

            _context.Projects.Add(project);

            project.Owner = command.Owner;

            _context.SaveChanges();

            command.NewId = project.Id;
        }