public async Task <HttpResponseMessage> PostCarToCreditAgreement(string id, [FromBody] BusinessLayer.Models.Presentation.Requests.Car.Car collateral) { if (collateral == null) { return(Request.CreateResponse(HttpStatusCode.BadRequest, new ArgumentNullException("collateral"))); } var dtoCollateral = (BusinessLayer.Models.Dto.Car.Car)collateral; string responseObj = await _service.PostCollateralToCreditagreementAsync(id, dtoCollateral); if (string.IsNullOrEmpty(responseObj)) { return(Request.CreateResponse(HttpStatusCode.BadRequest, "Ошибка при создании залога")); } await _unitOfWorkAsync.SaveChangesAsync(); //GEO if (!string.IsNullOrEmpty(dtoCollateral.RegistrationClientAddress)) { await СheckingAndPostGeoLocation(responseObj, dtoCollateral.Type, dtoCollateral.RegistrationClientAddress); } return(Request.CreateResponse(HttpStatusCode.OK, responseObj)); }
public async Task <HttpResponseMessage> PutCar(BusinessLayer.Models.Presentation.Requests.Car.Car collateral) { if (collateral == null) { return(Request.CreateResponse(HttpStatusCode.BadRequest, new ArgumentNullException("collateral"))); } var dtoCollateral = (BusinessLayer.Models.Dto.Car.Car)collateral; dtoCollateral.ModifyDate = DateTime.UtcNow; await _service.PutCollateralAsync(dtoCollateral); //GEO if (!string.IsNullOrEmpty(dtoCollateral.RegistrationClientAddress)) { await СheckingAndPostGeoLocation(dtoCollateral.Id, dtoCollateral.Type, dtoCollateral.RegistrationClientAddress); } await _unitOfWorkAsync.SaveChangesAsync(); return(Request.CreateResponse(HttpStatusCode.OK)); }