public ActionResult UnBanUser(string userName) { System.Web.Security.Roles.AddUserToRole(userName, "User"); if (System.Web.Security.Roles.GetRolesForUser(userName).Contains("Banned")) { System.Web.Security.Roles.RemoveUserFromRole(userName, "Banned"); } dynamic email = new Email("EmailToUser"); email.To = userName; email.UserName = data.retrieveUserByEmail(userName).FirstName; email.message = "You have been unbanned!"; email.Send(); string success = "Your email Has been delivered."; VMGeneralMessage message = new VMGeneralMessage("Email", "Email Sent", new string[] { success }); return View("GeneralMessage", message); }
public ActionResult RequestAddAsCollaborator(int projectId = -1, int userId = -1) { #region route data validation if (RouteData.Values["projectId"] != null) { if (int.TryParse(RouteData.Values["projectId"].ToString(), out projectId)) { } } Project project; project = db.retrieveProject(projectId); if (project == null) { string error1 = "The Project you to which you requested to be added as a Collaborator either does not exist or could not be found."; string error2 = "If the project Id is -1, then a project Id was not entered."; string error3 = "Project Id: " + projectId; TempData["ErrorMessages"] = new string[] { error1, error2, error3 }; return RedirectToAction("Http404", "Error"); } if (RouteData.Values["userId"] != null) { if (int.TryParse(RouteData.Values["userId"].ToString(), out userId)) { } } PortfolioUnleashed.User user; user = db.retrieveUser(userId); if (user == null) { string error1 = "The User who tried to make the request either does not exist or could not be found."; string error2 = "User Id: " + userId; TempData["ErrorMessages"] = new string[] { error1, error2 }; return RedirectToAction("Http404", "Error"); } if (project.Contributions.Any(c => c.UserId == userId)) { string error1 = "You are already a contributor to this project."; string error2 = "User: "******" " + user.LastName; string error3 = "Project: " + project.Title; TempData["ErrorMessages"] = new string[] { error1, error2, error3 }; return RedirectToAction("General", "Error"); } if (project.CollaborationSetting != (int)ContributionSetting.RequestOnly) { string error1 = "This Project does not allow users to request to be added as a collaborator."; string error2 = "If you would like to be added as a collaborator, contact a Project Editor."; string error3 = "Project Collaboration Setting: " + (ContributionSetting)project.CollaborationSetting; TempData["ErrorMessages"] = new string[] { error1, error2, error3 }; return RedirectToAction("General", "Error"); } #endregion new NotificationController().CollaborationRequest(userId, projectId); string message2 = "You will be notified if/when a Project Editor confirms your request."; VMGeneralMessage m = new VMGeneralMessage("Request Submitted", "Your Request to be added as a collaborator has been committed.", new string[] { message2 }); return View("GeneralMessage", model: m); }
public ActionResult SendEmailToUser(VMSendEmailToUser emails) { if (ModelState.IsValid) { if (data.retrieveUserByEmail(emails.to) != null) { dynamic email = new Email("EmailToUser"); email.To = emails.to; email.UserName = data.retrieveUserByEmail(emails.to).FirstName; email.message = emails.message; email.Send(); string success = "Your email Has been delivered."; VMGeneralMessage message = new VMGeneralMessage("Email", "Email Sent", new string[] { success }); return View("GeneralMessage", message); } } return View(); }
public ActionResult EditAccountSettings(VMEditAccountSettings model) { if (ModelState.IsValid) { UserSetting test = Translator.UserSettingFromVMEditAccountSettings(model); db.updateUserSettings(test, model.UserID); string completedUpdate = "You have updated your settings"; VMGeneralMessage message = new VMGeneralMessage("AccountUpdated","Updated Account", new string[] {completedUpdate}); return View("GeneralMessage", message); } return View(model); }
public ActionResult ConfirmationFailure() { string failure = "You have fails to confirm your account"; VMGeneralMessage message = new VMGeneralMessage("NotConfirmed", "Faild to confirm Account", new string[] { failure }); return View("GeneralMessage", message); }
public ActionResult ConfirmationSuccess() { string success = "You have confirmed your account"; VMGeneralMessage message = new VMGeneralMessage("Confirmed", "confirmed Account", new string[] { success }); return View("GeneralMessage", message); }
public ActionResult Login(VMLoginUser user) { if (ModelState.IsValid) { if (System.Web.Security.Roles.GetRolesForUser(user.Email).Contains("Banned")) { string failure = "Your account is currently banned"; VMGeneralMessage message = new VMGeneralMessage("Banned", "Account Banned", new string[] { failure }); return View("GeneralMessage", message); } if (WebSecurity.Login(user.Email, user.Password)) { return RedirectToAction("Index", "Home"); } else { return View(user); } } return View(user); }
public ActionResult RegistratoinStepTwo() { string confirmation = "Please check your email for a confirmation link to activate your account."; VMGeneralMessage message = new VMGeneralMessage("RegistrationStepTwo", "Registration Step Two", new string[] { confirmation }); return View("GeneralMessage", message); }