Esempio n. 1
0
 public ActionResult UserManager(User user)
 {
     user.UserId = (int)Session["LoggedUserId"];
     user.RoleId = (int)Session["LoggedUserRole"];
     _userRepository.InsertOrUpdate(user);
     _userRepository.Save();
     return(RedirectToAction("UserManager", "User", new { id = Session["LoggedUserId"] }));
 }
Esempio n. 2
0
 public ActionResult Edit(User user)
 {
     if (ModelState.IsValid)
     {
         _userRepository.InsertOrUpdate(user);
         _userRepository.Save();
         return(Session["LoggedUserRole"].Equals("Admin") ? RedirectToAction("Index") : RedirectToAction("UserManager", "User", new { id = Session["LoggedUserId"] }));
     }
     ViewBag.PossibleRole = _roleRepository.All;
     return(View());
 }
Esempio n. 3
0
        public bool FindUser(string nickname, string password)
        {
            IEnumerable <User> iEnumerable = _userRepository.All;

            foreach (var user in iEnumerable.Where(user => user.NickName == nickname && user.Password == password))
            {
                _currentUser = user;
                return(true);
            }
            return(false);
        }
Esempio n. 4
0
 public ActionResult Create(User user)
 {
     if (ModelState.IsValid)
     {
         _userRepository.InsertOrUpdate(user);
         _userRepository.Save();
         return(RedirectToAction("Index"));
     }
     ViewBag.PossibleRole = _roleRepository.All;
     return(View());
 }
Esempio n. 5
0
        public ActionResult FindOneFriend(User name)
        {
            IEnumerable <User> iEnumerable = _userRepository.All;

            _friendList = new List <User>();
            foreach (var user in iEnumerable.Where(user => user.NickName.Equals(name.NickName) || user.FirstName.Equals(name.NickName) || user.LastName.Equals(name.NickName)))
            {
                _friendList.Add(user);
            }
            return(RedirectToAction("FindFriend", "User"));
        }