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; }
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; }