public async Task <HttpResponseMessage> PutOtherCollateral(BusinessLayer.Models.Presentation.Requests.OtherCollateral.OtherCollateral collateral) { if (collateral == null) { return(Request.CreateResponse(HttpStatusCode.BadRequest, new ArgumentNullException("collateral"))); } var dtoCollateral = (BusinessLayer.Models.Dto.OtherCollateral.OtherCollateral)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)); }
public async Task <HttpResponseMessage> PostOtherCollateralToCreditagreement(string id, BusinessLayer.Models.Presentation.Requests.OtherCollateral.OtherCollateral collateral) { if (collateral == null) { return(Request.CreateResponse(HttpStatusCode.BadRequest, new ArgumentNullException("collateral"))); } var dtoCollateral = (BusinessLayer.Models.Dto.OtherCollateral.OtherCollateral)collateral; string responseObj = await _service.PostCollateralToCreditagreementAsync(id, dtoCollateral); await _unitOfWorkAsync.SaveChangesAsync(); if (string.IsNullOrEmpty(responseObj)) { return(Request.CreateResponse(HttpStatusCode.BadRequest, "Ошибка при создании залога")); } //GEO if (!string.IsNullOrEmpty(dtoCollateral.RegistrationClientAddress)) { await СheckingAndPostGeoLocation(responseObj, dtoCollateral.Type, dtoCollateral.RegistrationClientAddress); } return(Request.CreateResponse(HttpStatusCode.OK, responseObj)); }