private Models.UserProfileBio getUserProfileBio(string id) { var db = new Models.MyIdentityDbContext(); //Models.UserProfileBio bio = new Models.UserProfileBio(); /* * foreach (var obj in db.UserProfileBio) * { * if (obj.UserID == id) * { * bio = obj; * } * }*/ Models.UserProfileBio bio = db.UserProfileBio.FirstOrDefault(x => x.UserID == id); return(bio); /* * return Json(new * { * Bio = bio * }); */ }
private void addUserDefaultProfileBio(Models.MyIdentityUser user) { var db = new Models.MyIdentityDbContext(); Models.UserProfileBio bio = new Models.UserProfileBio(); bio.Id = Guid.NewGuid().ToString(); bio.UserID = user.Id; bio.AboutMe = string.Format("Hello World!, I'm {0}. Let's make some money!", user.FirstName); bio.Location = "Webvnue City"; bio.Gender = "Human"; bio.Quote = "\"You only live once, but if you do it right, once is enough.\" ― Mae West"; db.UserProfileBio.Add(bio); db.SaveChanges(); }
public ActionResult ajaxUserProfileBio(string id) { var db = new Models.MyIdentityDbContext(); Models.UserProfileBio bio = db.UserProfileBio.FirstOrDefault(x => x.UserID == id); //Models.UserProfileBio bio = new Models.UserProfileBio(); /* * foreach (var obj in db.UserProfileBio) * { * if (obj.UserID == id) * { * bio = obj; * } * } */ return(Json(new { Bio = bio })); }