Ejemplo n.º 1
0
        public List <Company> GetCompanies()
        {
            List <Company> objCompLst = new List <Company>();

            objCompLst = LibDAL.GetCompanies();

            return(objCompLst);
        }
Ejemplo n.º 2
0
        // GET: api/Company
        public HttpResponseMessage Get()
        {
            try
            {
                List <Company> objCompLst = new List <Company>();
                objCompLst = LibDAL.GetCompanies();

                if (objCompLst != null & objCompLst.Count > 0)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, objCompLst));
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "No Companies!"));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
            }
        }