예제 #1
0
        public IActionResult Get()
        {
            try
            {
                DataAccessSuppliers suppliersDALDC = new DataAccessSuppliers();
                List <Suppliers>    suppliers      = suppliersDALDC.GetSuppliersAsGenericList();

                return(Ok(suppliers));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }
예제 #2
0
        public IActionResult GetByName(string company_name)
        {
            try
            {
                DataAccessSuppliers suppliersDALDC = new DataAccessSuppliers();
                var suppliers = suppliersDALDC.GetSuppliersAsGenericList().Where(x => x.Company_Name == company_name).ToList();

                if (suppliers.Count() == 0)
                {
                    return(NotFound());
                }

                return(Ok(suppliers));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }