Пример #1
0
        public ActionResult EditProfile(StudentTracker.Core.Entities.Profile objProfile)
        {
            if (objProfile.ProfileId == 0)
            {
                string destDirectory = Server.MapPath("~/Attachments/ProfileImages");
                destDirectory = Path.Combine(destDirectory, _userStatistics.UserId.ToString());
                string fileUrl = Request.Url.GetLeftPart(UriPartial.Authority) + "/Attachments/ProfileImages";
                // destDirectory = Path.Combine(destDirectory, type, importId);
                if (Directory.Exists(destDirectory))
                {
                    var files = Directory.GetFiles(destDirectory);
                    if (files.Count() > 0)
                    {
                        objProfile.ProfileImageUrl = Path.Combine(fileUrl, _userStatistics.UserId.ToString(), files[0]);
                    }
                }
            }

            this.repository.UpdateUserProfile(objProfile);
            return RedirectToAction("profile", "account");
        }
Пример #2
0
 public ActionResult RegisterUser(StudentTracker.Core.Entities.User objUser)
 {
     StudentContext db = new StudentContext();
     var tokenObject = db.RegistrationTokens.Where(t => t.Token == objUser.RegistrationToken).FirstOrDefault();
     objUser.OrganizationId = tokenObject.OrganizationId;
     objUser.MasterId = tokenObject.CreatedBy;
     CodeFirstMembershipProvider membership = new CodeFirstMembershipProvider();
     var token = membership.CreateAccount(objUser);
     Roles.AddUserToRole(objUser.Username, Enum.GetName(typeof(UserRoles), tokenObject.RoleId));
     EmailHandler.Utilities.SendConfirmationEmail(objUser.Username);
     return RedirectToAction("Confirmation", "Account");
 }