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

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