public static pb_UserProfile GetUser() { var userName = WebMatrix.WebData.WebSecurity.CurrentUserName; bn_UserProfile userProfile = new bn_UserProfile(); return(userProfile.GetByUserName(userName)); }
public ActionResult p_UserContact(Guid userId) { bn_UserContact bnUserContact = new bn_UserContact(); bn_UserProfile bnUserProfile = new bn_UserProfile(); ps_UserContact model = new ps_UserContact(); model.UserProfile = bnUserProfile.GetById(userId); model.Contacts = bnUserContact.GetByUserId(userId); return(View(model)); }
public ActionResult Detail(Guid?id) { bn_UserProfile bnUser = new bn_UserProfile(); pb_UserProfile model = null; if (id.HasValue) { model = bnUser.GetById(id.Value); } return(View(model)); }
public ActionResult AllUser(int page = 1) { bn_UserProfile bnUser = new bn_UserProfile(); int numberOfPage = 24; ViewBag.CountPage = (bnUser.GetCountAll() / numberOfPage) + 1; page = page > 0 ? page : 1; page = page < ViewBag.CountPage ? page : ViewBag.CountPage; ViewBag.page = page; var model = bnUser.GetListInPage(page, numberOfPage); return(View(model)); }
public ActionResult Edit(Guid?userId) { if (!userId.HasValue) { userId = ps_Membership.GetUser().UserId; } bn_UserProfile bnUserProfile = new bn_UserProfile(); pb_UserProfile model = new pb_UserProfile(); model = bnUserProfile.GetById((Guid)userId); return(View(model)); }
public ActionResult Index(Guid?userId) { if (!userId.HasValue) { userId = ps_Membership.GetUser().UserId; } bn_UserContact bnUserContact = new bn_UserContact(); bn_UserProfile bnUserProfile = new bn_UserProfile(); ps_UserContact model = new ps_UserContact(); model.Contacts = bnUserContact.GetByUserId((Guid)userId); model.UserProfile = bnUserProfile.GetById((Guid)userId); return(View(model)); }
public ActionResult Register(RegisterModel model) { if (ModelState.IsValid) { // Attempt to register the user try { bn_UserProfile bnUserProfile = new bn_UserProfile(); if (!bnUserProfile.IsExists(model.Email)) { //email is not exists. var userId = Guid.NewGuid(); WebSecurity.CreateUserAndAccount( model.Email, model.Password, new { UserId = userId, FirstName = model.FirstName.Trim(), LastName = model.LastName.Trim() }); WebSecurity.Login(model.Email, model.Password); return(RedirectToRoute("Pure")); } else { ModelState.AddModelError("", "This email is alrealy exists."); } } catch (MembershipCreateUserException e) { ModelState.AddModelError("", ErrorCodeToString(e.StatusCode)); } } // If we got this far, something failed, redisplay form return(View(model)); }
public ActionResult Edit(pb_UserProfile model) { if (ModelState.IsValid) { bn_UserProfile bnUserProfile = new bn_UserProfile(); var re = bnUserProfile.Update( ps_Membership.GetUser().UserId, model.FirstName, model.LastName, model.DateOfBirth); if (re >= 0) { return(RedirectToAction("Index", "User")); } else { //can't udpate } } return(View(model)); }
public List <pb_UserProfile> Filter() { bn_UserProfile bnUser = new bn_UserProfile(isLazy: false); return(bnUser.GetAll()); }