public ActionResult Accept(int id) { var order = unitOfWork.OrderRep.Get(id); if (order != null) { if (!order.Accept) { unitOfWork.AcceptOrder(id); unitOfWork.Save(); } else { ViewBag.ErrorMessage = "Заказ уже принят"; return(View("Error")); } } else { ViewBag.ErrorMessage = "Заказ не найден"; return(View("Error")); } return(RedirectToAction("Orders")); }