public async Task AddAsync(Group group) { if (!(await faceAPIClient.GroupExistsAsync(group.Code))) { await faceAPIClient.GroupCreateAsync(group.Code, group.Name); await groupRepository.AddAsync(group); } else { throw new BusinessException($"Person group '{group.Code}' already exists."); } }
public async Task AddAsync(Group group) { if (!(await faceAPIClient.GroupExistsAsync(group.Code))) { // ToDo: Call faceAPIClient.GroupCreateAsync() here... throw new System.NotImplementedException(); await groupRepository.AddAsync(group); } else { throw new BusinessException($"Person group '{group.Code}' already exists."); } }
public async Task AddAsync(Group group) { // ToDo: Check if the group exists using GroupExistsAsync from faceAPIClient if (!(await faceAPIClient.GroupExistsAsync(group.Code))) { // ToDo: If the group do not exists, call faceAPIClient to create a group await faceAPIClient.GroupCreateAsync(group.Code, group.Name); // ToDo: If the group do not exists, call groupRepository to save the group details await groupRepository.AddAsync(group); } else { // ToDo: If the group already exists, throw a new BusinessException with the message "Person group '[CODE]' already exists." throw new BusinessException($"Person group '{group.Code}' already exists."); } }