// GET: User
        public ActionResult Profile(int id)
        {
            DataManager manager = new DataManager();
            var currentUser = manager.GetUser(id);
            ViewBag.UserLanguage = manager.GetUserLanguages(currentUser.id).Select(x => x.Language.name).ToList();
            return View(currentUser);

              //  return View();
        }
        // GET: Example
        public ActionResult Index()
        {
            DataManager manager = new DataManager();
            //var user = Storage.currentUser;
               var  user = manager.GetUser(3);

               var list = manager.GetUserLanguages(user.id).Select(x => x.Language.name).ToList();
               ViewBag.UserLanguage = list;
            return View(user);
        }
        public ActionResult Index(LoginViewModel loginModel, string returnUrl, bool? a = null)
        {
            DataManager manager = new DataManager();
            string name = "";
            int id = -1;
            bool have = manager.CheckUserLogin(loginModel, ref name, ref id);

            if (have)
            {
                FormsAuthentication.SetAuthCookie(name, loginModel.RememberMe);
                Storage.SaveCookieID(Storage.aliasUserID, id.ToString(), DateTime.Now.AddYears(1));

                return Redirect(returnUrl ?? Url.Action("Index", "Home"));
            }
            else
            {
                loginModel.Password = null;
                ReturnUrl = "";
                ModelState.AddModelError("LoginAndPassword_DoesNotMatch", "Oops, either name or password does not match, try again");
                return View();
            }
        }
        public ActionResult PictureForProfile(int userID)
        {
            DataManager manager = new DataManager();
            var user = manager.GetUser(userID);

            if (user != null && user.Photo != null && !string.IsNullOrEmpty(user.ContentType))
                return File(user.Photo, user.ContentType);
            else
            {
                var path = Path.Combine(Server.MapPath("~/images/Profile"), Path.GetFileName("no_Profile_Image.png"));

                var bytes = new byte[1668];

                using(FileStream fs = new FileStream(path, FileMode.Open)){
                    using (var read = new BinaryReader(fs))
                    {
                        bytes = read.ReadBytes((int)fs.Length);
                    }
                }
                return File(bytes , "image/png");
            }
        }
 public BaseController()
 {
     manager = new DataManager();
 }
 //[MyAuthorize(Users = "admin, Alex", Roles = "admin")]
 public AccountController()
 {
     manager = new DataManager();
     //if (user == null)
     //    return RedirectToAction("Index", "Login", new { returnUrl = Request.UrlReferrer != null ? Request.UrlReferrer.OriginalString : "" });
 }