Ejemplo n.º 1
0
        // GET: Customers/Details/5
        public ActionResult Details(int?id)
        {
            #region EF6 Code
            //if (id == null)
            //{
            //    return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            //}
            //Customer customer = db.CustomerSet.Find(id);
            //if (customer == null)
            //{
            //    return HttpNotFound();
            //}
            //return View(customer);
            #endregion

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var customer = _repo.GetCustomerWithOrders(id.Value);
            if (customer == null)
            {
                return(HttpNotFound());
            }
            return(View(customer));
        }