예제 #1
0
        public static ResponseViewModel <List <GetOrderByCustomerId_Result> > GetOrderDetailsByCustomerID(int customerId)
        {
            ResponseViewModel <List <GetOrderByCustomerId_Result> > viewModel = new ResponseViewModel <List <GetOrderByCustomerId_Result> >();

            using (EcommerceEntities entites = new EcommerceEntities())
            {
                viewModel.Data = entites.GetOrderByCustomerId(customerId).ToList();
                if (viewModel.Data != null)
                {
                    return(viewModel);
                }
            }
            viewModel.errorViewModel            = new ErrorViewModel();
            viewModel.errorViewModel.statusCode = 500;
            return(viewModel);
        }