예제 #1
0
        public Task <int> AddPropertyAsync(int agencyId, AddPropertyRequestDto model)
        {
            return(HandleAsync(async() =>
            {
                var client = GetPropertyClient();

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

                var response = await client.AddPropertyAsync(request);

                return response.Id;
            }));
        }
예제 #2
0
        public async Task <int> AddAsync(int agencyId, AddPropertyRequestDto 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,
                });
            }

            return(await _client.AddPropertyAsync(agencyId, request));
        }
예제 #3
0
        public PmsResponseDto AddProperty([FromBody] AddPropertyRequestDto request)
        {
            if (request == null || request.Property == null)
            {
                throw new PmsException("Property can not be added.");
            }

            var response = new PmsResponseDto();
            var Id       = _iPmsLogic.AddProperty(request.Property);

            if (Id > 0)
            {
                response.ResponseStatus    = PmsApiStatus.Success.ToString();
                response.StatusDescription = "Record saved successfully.";
                response.ResponseObject    = Id;
            }
            else
            {
                response.ResponseStatus    = PmsApiStatus.Failure.ToString();
                response.StatusDescription = "Operation failed.Please contact administrator.";
            }
            return(response);
        }