示例#1
0
        // Finner en eller flere kundetyper for et firma
        //Get /api/Test/1

        public IEnumerable <CustomerDto> GetTest(int Id)
        {
            List <Customer> types    = new List <Customer>();
            var             customer = _context.CustomerToTypes.Where(c => c.CustomerTypeId == Id).ToList();

            foreach (var type in customer)
            {
                types.Add(type.Customer);
            }
            return(DtoHelper.MapCustomerListToDto(types));
        }
示例#2
0
        //GET /api/customers
        public IEnumerable <CustomerDto> GetCustomers()
        {
            var customers = _context.Customers.ToList();



            List <CustomerDto> dtoCustomerList = DtoHelper.MapCustomerListToDto(customers);



            if (dtoCustomerList.Count() == 0)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }

            return(dtoCustomerList);
        }