コード例 #1
0
        public IHttpActionResult GetCustomerLines(string idCard)
        {
            if (string.IsNullOrWhiteSpace(idCard))
            {
                return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.NoContent, "Sorry, we could not get the data")));
            }

            List <Line> customerLines;

            try
            {
                customerLines = _lineManager.GetCustomerLines(idCard);
            }
            catch (Exception)
            {
                return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Something went wrong")));
            }

            if (customerLines != null)
            {
                return(Ok(customerLines));
            }
            else
            {
                return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.NoContent, "Could not found lines to this customer")));
            }
        }