public MyProfileModel(UserProfile up) { this.FullName = up.FullName; this.BirthDate = up.BirthDate; this.Location = up.Location; this.UserTheme = up.UserTheme; this.Biography = up.Biography; }
public ActionResult MyProfile() { using (var ctx = new Entities()) { int userid = Authentication.GetLoggedUser().UserID; UserProfile up = ctx.UserProfiles.FirstOrDefault(i => i.UserID == userid); if (up == null) { up = new UserProfile(); } var profile = new MyProfileModel(up); ViewBag.UserThemeList = new Choice(Utils.GetThemes(), true, up.UserTheme).GetSelectList(); return View(profile); } }