コード例 #1
0
        public Task <int> EditPropertyAsync(int agencyId, EditPropertyRequestDto model)
        {
            return(HandleAsync(async() =>
            {
                var client = GetPropertyClient();

                var request = Mapping.Mapper.Map <EditPropertyRequest>(model, opt =>
                                                                       opt.AfterMap((src, dest) => dest.AgencyId = agencyId));

                var response = await client.EditPropertyAsync(request);

                return response.Id;
            }));
        }
コード例 #2
0
        public async Task <int> EditAsync(int agencyId, EditPropertyRequestDto request)
        {
            var newAttacments = new List <PropertyAttachmentDto>();

            foreach (var file in request.AttachmentsToAdd)
            {
                var url = await UploadFileAsync(file);

                newAttacments.Add(new PropertyAttachmentDto
                {
                    Name = file.Name,
                    Url  = url,
                });
            }

            request.Attachments = request.Attachments.Concat(newAttacments);

            return(await _client.EditPropertyAsync(agencyId, request));
        }