public ActionResult Create(RequestPassenger rp)
        {
            if (ModelState.IsValid)
            {
                if (rp.Request.ApproverEmployeeId == 0)
                {
                    ViewBag.ErrorMessage = "Веберите руководителя, который подпишет заявку!";
                    return View(rp);
                }
                try
                {

                    rp.Request.Status = 0;
                    rp.Request.UserLogin = User.Identity.Name;
                    rp.Request.UserFio = AccountManager.GetUserDisplayName(User.Identity.Name);
                    rp.Request.PublishDate = DateTime.Now;
                    rp.Request.IsDeleted = false;

                    if (Utils.AccountManager.IsApprover(User.Identity.Name).Item2)
                    {
                        rp.Request.Status = 1;
                        rp.Request.ApproveDate = DateTime.Now;
                        rp.Request.ApproverLogin = User.Identity.Name;
                        rp.Request.ApproverFio = Utils.AccountManager.GetUserDisplayName(User.Identity.Name);

                        RequestEvent re = new RequestEvent();
                        re.Status = 1;
                        re.EventDate = DateTime.Now;
                        rp.Request.RequestEvents.Add(re);
                    }

                    if (rp.Request.CustomerId == 0)
                        rp.Request.CustomerId = null;

                    _db.RequestPassengers.Add(rp);
                    _db.SaveChanges();
                    return View("Published", rp.Request.RequestId);
                }
                catch
                {
                    ViewBag.ErrMessage = "Ошибка при создании записи";
                    ViewBag.BackController = "Passenger";
                    return View("Error");
                }
            }
            return View();
        }
        public ActionResult Edit(RequestPassenger rp)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var model = _db.RequestPassengers.Single(m => m.RequestId == rp.RequestId);

                    model.DestinationPoint = rp.DestinationPoint;
                    model.PassengerAmount = rp.PassengerAmount;
                    model.ChildAmount = rp.ChildAmount;
                    model.Request.RequestDate = rp.Request.RequestDate;
                    model.OrderDate = rp.OrderDate;
                    model.OrderName = rp.OrderName;
                    model.OrderNumber = rp.OrderNumber;
                    model.TripPurpose = rp.TripPurpose;
                    model.TripDuration = rp.TripDuration;
                    model.SeatPlace = rp.SeatPlace;
                    model.SecondedPeople = rp.SecondedPeople;
                    model.Request.ApproverEmployeeId = rp.Request.ApproverEmployeeId;

                    if (rp.Request.CustomerId == 0)
                        rp.Request.CustomerId = null;

                    model.Request.CustomerId = rp.Request.CustomerId;

                    if (model.Request.Status == 3 && User.Identity.Name.ToLower() == model.Request.UserLogin.ToLower())
                    {
                        model.Request.Status = 0;
                        RequestEvent re = new RequestEvent();
                        re.Status = 0;
                        re.Message = String.Empty;
                        re.EventDate = DateTime.Now;
                        model.Request.RequestEvents.Add(re);
                    }

                    _db.SaveChanges();
                    return RedirectToAction("Index", "Home");
                }
                catch
                {
                    ViewBag.ErrMessage = "Ошибка при редактировании записи";
                    ViewBag.BackController = "Home";
                    return View("Error");
                }
            }
            return View();
        }