public async Task <string> Create(string companyId, CreateProjectVm vm) { var company = await _companyRepository.GetFirstOrDefault(companyId) ?? throw new Exception($"No Company found against id:'{companyId}'"); var project = new Core.Model.Project(company, vm.Title, vm.Description); company.AddProject(project); await _companyRepository.SaveChanges(); return(project.Id); }
public async Task <string> Add([GraphQLSession] AuthSession session, [Service] IProjectCommandService service, CreateProjectVm model) { return(Ok(await service.Create(session.CompanyId, model))); }