public ActionResult DeleteValve(int valveID, string returnURL, bool confirmed = false)
        {
            ModelState.Clear();
            if(confirmed)
            {
                Valve valve = repositorie.Valves.SingleOrDefault(v => v.V_ID == valveID);
                valve.V_deletedBy = System.Web.HttpContext.Current.User.Identity.Name;
                try
                {
                    repositorie.SaveValve(valve);
                }
                catch (Exception e)
                {
                    ModelState.AddModelError("1", e.Message);
                }

            }

            if (ModelState.IsValid)
            {
                //все в порядке
                return Redirect(returnURL);
            }
            else
            {
                //имеются ожибки БД, отобразим их пользователю
                DeleteValve_VM model = new DeleteValve_VM
                {
                    ReturnURL = returnURL,
                    Valve = repositorie.Valves.SingleOrDefault(v => v.V_ID == valveID)
                };
                return View(model);

            }
        }
 public ActionResult DeleteValve(int valveID, string returnURL)
 {
     DeleteValve_VM model = new DeleteValve_VM
     {
         ReturnURL = returnURL,
         Valve = repositorie.Valves.SingleOrDefault(v=>v.V_ID == valveID)
     };
     return View(model);
 }