Пример #1
0
        public HttpResponseMessage AppraiseProperty([FromBody] DetailInput detailInput)
        {
            try
            {
                //if (!IsAuthorised(out errorMessage))
                //    return Request.CreateErrorResponse(HttpStatusCode.Unauthorized, errorMessage);

                if (!ModelState.IsValid)
                {
                    return(Request.CreateResponse(HttpStatusCode.BadRequest, ModelState));
                }

                string userAgent = String.Empty;

                if (Request.Headers.UserAgent != null)
                {
                    userAgent = Convert.ToString(Request.Headers.UserAgent);
                }

                apiManager = new APIManager(token);
                AppServiceApi.Models.AppraisalOutput appraisalOutput = apiManager.processDetailInput(detailInput, userAgent);
                return(Request.CreateResponse(HttpStatusCode.OK, appraisalOutput));
            }
            catch (Exception ex)
            {
                ErrorAsync(ex, Request.RequestUri.AbsoluteUri.ToString());
                return(Request.CreateResponse(HttpStatusCode.BadRequest, new { message = "Bad Request" }));
            }
        }
Пример #2
0
        public AppraisalOutput processDetailInput(DetailInput detailInput, string userAgent)
        {
            PriceInput      priceInput      = MapDetailInputToPriceInput(detailInput);
            AppraisalOutput appraisalOutput = new AppraisalOutput();

            CalculatePrice(priceInput, detailInput.catCode ?? 0, appraisalOutput);

            appraisalOutput.microRating = detailInput.microRating ?? 0;
            appraisalOutput.zip         = detailInput.zip;
            appraisalOutput.town        = detailInput.town;
            appraisalOutput.street      = detailInput.street;
            appraisalOutput.CatCode     = detailInput.catCode ?? 0;
            appraisalOutput.country     = detailInput.country;

            ////Saving
            try
            {
                SavePricePropertyDetails(MapPriceBuisnessDataToDatabaseModel(null, null, null, detailInput.deviceId, appraisalOutput), userAgent);
            }
            catch (Exception ex)
            {
                RealEstateRepository realEstateRepository = new RealEstateRepository();
                realEstateRepository.saveException(ex.Message, Convert.ToString(ex.InnerException), ex.StackTrace);
                return(appraisalOutput);
            }

            return(appraisalOutput);
        }
Пример #3
0
        private PriceInput MapDetailInputToPriceInput(DetailInput detailInput)
        {
            PriceInput priceInput = new PriceInput();

            priceInput.surfaceLiving = detailInput.surfaceLiving ?? 0;
            priceInput.surfaceGround = detailInput.landSurface;
            priceInput.roomNb        = detailInput.roomNb ?? 0;
            priceInput.bathNb        = detailInput.bathNb ?? 0;
            priceInput.buildYear     = detailInput.buildYear ?? 0;
            priceInput.qualityMicro  = detailInput.microRating ?? 0;
            priceInput.zip           = detailInput.zip;
            priceInput.town          = detailInput.town;
            priceInput.street        = detailInput.street;

            return(priceInput);
        }
Пример #4
0
 public JsonResult QueryLotDetail(DetailInput input)
 {
     return(JsonForGridPaging(_HoldWIPLogicLogic.QueryLotDetail(input)));
 }