public ActionResult Create(Staff model)
        {
            try
            {
                model.EnrollmentDate = DateTime.Now;
                if (ModelState.IsValid)
                {
                    if (Membership.GetUser(model.UserID.ToString()) == null)
                    {
                        Membership.CreateUser(model.UserID.ToString(), PaddPassword.Padd(model.LastName), model.Email);
                        Roles.AddUserToRole(model.UserID.ToString(), model.Role);
                        work.StaffRepository.Insert(model);
                        work.Save();
                    }
                    else
                    {

                        ModelState.AddModelError("", "Staff ID Already Exist, Please user another ID!");
                        List<SelectListItem> theItem3 = new List<SelectListItem>();
                        string[] theRoles = Roles.GetAllRoles();

                        theItem3.Add(new SelectListItem() { Text = "None", Value = "" });
                        foreach (var role in theRoles)
                        {

                            theItem3.Add(new SelectListItem() { Text = role, Value = role });

                        }
                        ViewData["Role"] = theItem3;
                        return View();
                    }
                }
                // TODO: Add insert logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
        public ActionResult Edit(Staff model)
        {
            try
            {
                // TODO: Add update logic here
                UnitOfWork work2 = new UnitOfWork();
                Staff staff = work2.StaffRepository.GetByID(model.StaffID);
                string[] RoleList = Roles.GetAllRoles();
                //  Roles.RemoveUserFromRoles(model.UserID.ToString(), RoleList);
                foreach (var role in RoleList)
                {
                    if (Roles.IsUserInRole(model.UserID.ToString(), role))
                    {
                        Roles.RemoveUserFromRole(model.UserID.ToString(), role);
                    }
                }
                Roles.AddUserToRole(model.UserID.ToString(), model.Role);
                // work.StaffRepository.Update(model);

                SilverDaleSchools.Models.Tweaker.AdjustTimer(model.UserID.ToString());
                TryUpdateModel(model);
                if (ModelState.IsValid)
                {
                    work.StaffRepository.Update(model);
                    work.Save();
                }

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
        public ActionResult Delete(Staff model)
        {
            try
            {
                // TODO: Add delete logic here
                Staff theStaff = work.StaffRepository.GetByID(model.StaffID);

                string theUserString = model.UserID;// user.UserName;
                var user = Membership.GetUser(theUserString);
                _rolesService.RemoveFromAllRoles(user);
                _userService.Delete(user);

                work.StaffRepository.Delete(theStaff);
                work.Save();

                // DELETE FROM table_name WHERE some_column=some_value
                string con = System.Configuration.ConfigurationManager.ConnectionStrings["sdDatabase"].ConnectionString;
                SqlConnection conn = new System.Data.SqlClient.SqlConnection(con);
                SqlCommand updateCmd = new SqlCommand("DELETE FROM Users " +
                    //"SET LastActivityDate = @LastActivityDate " +
              "WHERE UserName = @UserName", conn);

                //  updateCmd.Parameters.Add("@LastActivityDate", SqlDbType.DateTime).Value = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).AddMinutes(-10);
                updateCmd.Parameters.Add("@UserName", SqlDbType.VarChar).Value = theUserString;
                //updateCmd.Parameters.Add("@ApplicationName", SqlDbType.VarChar, 255).Value = m_ApplicationName;
                conn.Open();
                updateCmd.ExecuteNonQuery();
                conn.Close();
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }