public MobileResponseWrapper Get([FromUri] OrderSearchParameter query) { try { if (query == null) { throw CreateException(HttpStatusCode.BadRequest, "Invalid or Incomplete Order information", 101416); } string obj = JsonConvert.SerializeObject(query); query.Locale = Thread.CurrentThread.CurrentCulture.Name; var result = _mobileOrderSummaryProvider.GetOrders(query); if (result != null) { if (!string.IsNullOrEmpty(query.OrderNumber)) { result = result.FindAll(r => r.OrderNumber == query.OrderNumber); } var response = new MobileResponseWrapper { Data = new OrdersResponseViewModel { Orders = result, RecordCount = result != null && result.Any() ? result.Count : 0 } }; JObject json = JObject.Parse(obj); MobileActivityLogProvider.ActivityLog(json, response, query.MemberId, true, this.Request.RequestUri.ToString(), this.Request.Headers.ToString(), this.Request.Headers.UserAgent.ToString(), query.Locale); return(response); } if (!string.IsNullOrEmpty(query.OrderNumber)) { var cartId = 0; var orderViewModel = _iMobileOrderProvider.GetOrderByOrderNumber(query.OrderNumber, query.MemberId, query.Locale, ref cartId); if (null != orderViewModel) { var mobResponseWrapper = new MobileResponseWrapper { Data = new OrdersResponseViewModel { Orders = new List <OrderViewModel> { orderViewModel }, RecordCount = 1 } }; JObject json1 = JObject.Parse(obj); MobileActivityLogProvider.ActivityLog(json1, mobResponseWrapper, query.MemberId, true, this.Request.RequestUri.ToString(), this.Request.Headers.ToString(), this.Request.Headers.UserAgent.ToString(), query.Locale); return(mobResponseWrapper); } } } catch (Exception ex) { LoggerHelper.Error(ex.ToString()); throw CreateException(HttpStatusCode.InternalServerError, "Internal server errror searching for Get Orders" + ex.Message, 404); } var responseWrapper = new MobileResponseWrapper { Data = new OrdersResponseViewModel { Orders = null, RecordCount = 0 } }; MobileActivityLogProvider.ActivityLog(query, responseWrapper, query.MemberId, true, this.Request.RequestUri.ToString(), this.Request.Headers.ToString(), this.Request.Headers.UserAgent.ToString(), query.Locale); return(responseWrapper); }