private string NewProductWith(string tenantId, string productOwnerId, string name, string description, DiscussionAvailability discussionAvailability) { var tid = new TenantId(tenantId); var productId = default(ProductId); ApplicationServiceLifeCycle.Begin(); try { productId = _productRepository.GetNextIdentity(); var productOwner = _productOwnerRepository.Get(tid, productOwnerId); var product = new Product(tid, productId, productOwner.ProductOwnerId, name, description, discussionAvailability); _productRepository.Save(product); ApplicationServiceLifeCycle.Success(); } catch (Exception ex) { ApplicationServiceLifeCycle.Fail(ex); } // TODO: handle null properly return(productId.Id); }
public ProductOwnerDTO GetById(int Id) { ProductOwnerDTO retour = new ProductOwnerDTO(); ProductOwner objet = _repo.Get(Id); retour = MapProductOwnerDTO.ToDto(objet); return(retour); }
public void EnableProductOwner(EnableProductOwnerCommand command) { var tenantId = new TenantId(command.TenantId); ApplicationServiceLifeCycle.Begin(); try { var productOwner = _productOwnerRepository.Get(tenantId, command.Username); if (productOwner != null) { productOwner.Enable(command.OccurredOn); } else { productOwner = new ProductOwner(tenantId, command.Username, command.FirstName, command.LastName, command.EmailAddress, command.OccurredOn); _productOwnerRepository.Save(productOwner); } ApplicationServiceLifeCycle.Success(); } catch (Exception ex) { ApplicationServiceLifeCycle.Fail(ex); } }