// 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 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"); } }