public IHttpActionResult GetAttributes(string id) { String apiUser = RequestContext.Principal.Identity.Name; OfferAttributesResponse _responseEnvelope = new OfferAttributesResponse(Request.Properties["requestId"].ToString(), true); AutomationManager.OfferObjectToOfferApiObject(AutomationManager.offers, true); AutomationManager.RespondentAttributeToOfferApiObject(AutomationManager.offers); RequestContext.RouteData = new HttpRouteData(RequestContext.RouteData.Route, new HttpRouteValueDictionary { { "controller", "testoffers" } }); OffersManager = new OffersManager(AutomationManager.IOfferRepository.Object, AutomationManager.IOfferAttributeRepository.Object, AutomationManager.IProviderRepository.Object, AutomationManager.IAttributeRepository.Object, AutomationManager.ILiveMatch.Object, AutomationManager.IRespondentCatalog.Object, AutomationManager.IQuotaExpressionRepository.Object, AutomationManager.IQuotaMappingRepository.Object, AutomationManager.ISampleMappingRepository.Object, AutomationManager.IGMIStudy.Object, AutomationManager.ISteamStudy.Object, AutomationManager.IQuotaLiveMatch.Object); var result = new TestOffersController(OffersManager, this.Request, this.RequestContext).GetAttributes(id) as OkNegotiatedContentResult<OfferAttributesResponse>; return Ok(result.Content); }
public IHttpActionResult GetAttributes(string id) { MonitorEvent evt = new MonitorEvent("OfferService"); int status = 1; String apiUser = RequestContext.Principal.Identity.Name; OfferAttributesResponse _responseEnvelope = new OfferAttributesResponse(Request.Properties["requestId"].ToString(), true); try { _responseEnvelope.Data = OffersManager.GetOfferAttributes(Request, apiUser, id); } catch (Exception e) { //Edit for R184 _responseEnvelope.Data.Errors.Add(new ErrorObject(ErrorKey.ERR_INTERNAL_FATAL)); //R185 Modification //_responseEnvelope.Data.Errors.Add(new ErrorObject(ErrorKey.ERR_INTERNAL_FATAL)); LoggerFactory.GetLogger().InfoJson(new Methods().Exception_ToLogObject(_responseEnvelope.Meta.Id, RequestContext.Principal.Identity.Name, OperationType, OperationName, e)); status = 0; } finally { if (_responseEnvelope.Data.Errors.Count > 0) { if (_responseEnvelope.Data.Errors.Exists(i => i.Id == ErrorKey.ERR_INTERNAL_FATAL)) status = 0; _responseEnvelope.Status = false; } else _responseEnvelope.Data.Errors = null; evt.Log(_responseEnvelope.Meta.Id, "GetOffersAttributes", status); } return Ok(_responseEnvelope); }