public ActionResult DeleteUser(int id)
        {
            if (Session["LoggedUserName"] == null || Session["IsAdmin"].ToString() == "0")
                return RedirectToAction("Login", "Bh");

            UserModel bm = users.Single(x => x.Id == id);
            if (bm.IsAdmin && users.Count(x => x.IsAdmin) == 1)
                return RedirectToAction("IndexUsers");

            BugBusinessLayer.BugBusinessLayerControl obc = new BugBusinessLayerControl();
            obc.DeleteUser(bm);
            return RedirectToAction("IndexUsers");
        }
 public ActionResult EditUser(UserModel bm)
 {
     if (Session["LoggedUserName"] == null || Session["IsAdmin"] == "0")
         return RedirectToAction("Login", "Bh");
     //if (ModelState.IsValid)
     {
         BugBusinessLayer.BugBusinessLayerControl obc = new BugBusinessLayerControl();
         //FillEmptyFields(bm);
         obc.UpdateUser(bm);
         return RedirectToAction("IndexUsers");
     }
     //else
     //    return View(bm);
 }
 public ActionResult CreateUser(UserModel pm)
 {
     if (Session["LoggedUserName"] == null || Session["IsAdmin"] == "0")
         return RedirectToAction("Login", "Bh");
     if (ModelState.IsValid && usernameFlag == 1 && usernameFlagSpace == 1)
     {
         BugBusinessLayer.BugBusinessLayerControl obc = new BugBusinessLayerControl();
         obc.AddUser(pm);
         return RedirectToAction("IndexUsers");
     }
     return View(pm);
 }