public IHttpActionResult GetAttribute([FromUri] string id) { String apiUser = RequestContext.Principal.Identity.Name; AttributeResponse _responseEnvelope = new AttributeResponse(Request.Properties["requestId"].ToString(), true); AutomationManager.AttributeObjectToAttributeDetailsApiObject(AutomationManager.attributes); AttributesManager = new AttributesManager(AutomationManager.IAttributeRepository.Object); var result = new AttributesController(AttributesManager, this.Request, this.RequestContext).GetAttribute(id) as OkNegotiatedContentResult<AttributeResponse>; return Ok(result.Content); }
public IHttpActionResult GetAttribute([FromUri] string id) { OperationName = operationName.GetAttributeOptions.ToString(); MonitorEvent evt = new MonitorEvent("OfferService"); String apiUser = RequestContext.Principal.Identity.Name; int status = 1; AttributeResponse _responseEnvelope = new AttributeResponse(Request.Properties["requestId"].ToString(), true); parameters.Add("AttributeId", id); try { _responseEnvelope.Data = AttributesManager.GetAttribute(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, "GetAttributeOptions", status); } return Ok(_responseEnvelope); }