public ActionResult SignIn(Users user)
 {
     if (ModelState.IsValidField("Login") && ModelState.IsValidField("Password") &&
         !userLogic.Authentication(user))
     {
         ModelState.AddModelError("Login", "User does not exist.");
         ModelState.AddModelError("Password", "User does not exist.");
     }
     if (ModelState.IsValidField("Login") && ModelState.IsValidField("Password"))
     {
         Users _user = userLogic.GetByLogin(user.Login);
         //TempData["Id"] = _user.Id;
         //TempData["Name"] = _user.Name;
         //TempData["Surname"] = _user.Surname;
         //TempData["Login"] = user.Login;
         //TempData["Password"] = user.Password;
         //TempData["City"] = _user.City;
         FormsAuthentication.SetAuthCookie(_user.Name, true);
         return(RedirectToAction("Menu", "Menu"));
     }
     else
     {
         return(View());
     }
 }
        public User GetUserByLogin(string login)
        {
            var user = new User();

            try
            {
                user = _userLogic.GetByLogin(login);
            }
            catch (SqlException ex)
            {
                Logger.LogShortErrorInfo(ex);
                return(null);
            }
            return(user);
        }
        public override bool IsUserInRole(string userName, string roleName)
        {
            var user = new User();

            user = _userLogic.GetByLogin(userName);

            if (user != null)
            {
                var userRole = user.Roles.FirstOrDefault(role => role.Title == roleName);
                return(userRole != null);
            }
            else
            {
                return(false);
            }
        }