protected void dsHistory_Updating(object sender, ObjectDataSourceMethodEventArgs e)
 {
     CF.History history = e.InputParameters[0] as CF.History;
     DriverManager dm = new DriverManager();
     UserManager um = new UserManager();
     history.Driver = dm.GetById(Convert.ToInt32((fvEditHistory.FindControl("ddlDrivers") as DropDownList).SelectedValue));
     history.User = um.GetById(Convert.ToInt32((fvEditHistory.FindControl("ddlUsers") as DropDownList).SelectedValue));
 }
        public ActionResult UserRegister(UserRegistrationModel model)
        {
            AuthenticationProvider ap = new AuthenticationProvider();
            if (ap.LoginMach(model.Login))
            {
                ModelState.AddModelError("Login", "Login must be unique");
                return View("UserRegister", model);
            }
            UserManager um = new UserManager();
            UserRegistrationModel urm = new UserRegistrationModel();
            if (ModelState.IsValid)
            {

                um.Insert(GetUser(model));
            }

            return View("UserRegister", urm);
        }