public async Task <ActionResult <Guid> > Register(RegisterOrganizationDto registerOrganizationDto) { var logo = registerOrganizationDto.Logo; var images = registerOrganizationDto.Images; var contacts = registerOrganizationDto.Contacts; return(Created(string.Empty, await _organizationsService.RegisterOrganizationAsync( await Organization.NewAsync(CreateOrganization.New( OrganizationType.GetById(registerOrganizationDto.OrganizationTypeId), new CreateOrUpdateContacts( contacts.ActualAddress, contacts.ActualGeoPosition, contacts.PhoneNumber, contacts.Email, contacts.Site, contacts.Telegram, contacts.Instagram, contacts.Vk), registerOrganizationDto.LegalName, registerOrganizationDto.LegalAddress, registerOrganizationDto.ActualName, registerOrganizationDto.TIN, logo == null ? null : CreateOrganizationLogo.New(logo), images == null ? Enumerable.Empty <CreateImage>() : images.Select(CreateImage.New)))))); }
public static async Task <OrganizationLogo> NewAsync(CreateOrganizationLogo createLogo) { await using var memoryStream = new MemoryStream(); await SixLabors.ImageSharp.Image.Load(createLogo.Content).SaveAsync(memoryStream, new PngEncoder()); return(new OrganizationLogo( Guid.NewGuid(), memoryStream.GetBuffer())); }