public IActionResult Index(ProfileViewModel model, int page = 1, bool changeFilters = true) { if (changeFilters) { HttpContext.Session.SetOrUpdate <ProfileViewModel>("ProfileFilters", model); } else { model = HttpContext.Session.Get <ProfileViewModel>("ProfileFilters"); } if (User.IsInRole("User")) { model.UserName = User.Identity.Name; } if (model.Status == "-") { model.Status = null; } if (model.SortType == "-") { model.SortType = null; } model.Page = page; model.Qty = Qty; var result = ProfileLogic.GetProfile(model); if (result.GetModel != null) { return(View(result.GetModel)); } TempData.AddOrUpdate("Error", result.GetErrorMessage); return(Redirect(Request.Headers["Referer"].ToString())); }
public IActionResult EditInfo(EditInfoViewModel model) { if (ModelState.IsValid) { model.UserName = User.Identity.Name; var result = ProfileLogic.EditMail(model); TempData.AddOrUpdate("EditMailMessage", result); return(RedirectToAction("Edit", "Account")); } TempData.Add("EditMailMessage", "Email is not valid"); return(RedirectToAction("Edit", "Account")); }
public IActionResult EditPassword(EditPasswordViewModel model) { if (ModelState.IsValid) { model.UserName = User.Identity.Name; var result = ProfileLogic.EditPassword(model); TempData.AddOrUpdate("EditPasswordMessage", result); return(RedirectToAction("Edit", "Account")); } if (ModelState["ConfirmPassword"].ValidationState == ModelValidationState.Invalid) { ModelState.AddModelError(string.Empty, "Passwords don't match"); } return(RedirectToAction("Edit", "Account")); }
protected void SaveButton_Click1(object sender, EventArgs e) { Profile newProfile = new Profile(); newProfile.ProfileName = txtProfileName.Text; if (ProfileLogic.IsExists(txtProfileName.Text)) { ShowNotification(false, string.Format("A Profile with this {0} already exists", txtProfileName.Text), ""); return; } else { ProfileLogic.AddNewEntity(newProfile); // ShowNotification(true, "Sucessfully Created", "AddCategoryOrProfile.aspx"); } if (hdnCategories.Value.Contains(",")) { string[] categoryNames = hdnCategories.Value.Replace(" ", "_").Split(','); foreach (string c in categoryNames) { Category newCategory = new Category(); newCategory.CategoryName = c; newCategory.Profile = newProfile; if (CategoryLogic.IsExists(c)) { ShowNotification(false, string.Format("A Category with this {0} already exists", c), ""); // return; } else { CategoryLogic.AddNewEntity(newCategory); ShowNotification(true, "Sucessfully Created", "AddCategoryOrProfile.aspx"); } } } else { Category newCategory = new Category(); newCategory.CategoryName = hdnCategories.Value.ToString(); CategoryLogic.AddNewEntity(newCategory); } }
public void TestValidateUsername() { UserProfileRequest loginRequest = new UserProfileRequest { UserName = "******", }; var profileLogic = new ProfileLogic(); CommonResponse response = profileLogic.ValidateLoginUserName(loginRequest); }
public void TestGetProfilePhotoTypesLogic() { List<ProfilePhotoType> results = new List<ProfilePhotoType>(); LogHelper.LogInformation("Here we go..."); try { var logic = new ProfileLogic(); results = logic.GetProfilePhotoTypes(); } catch (Exception ex) { LogHelper.LogError(ex, "What Happened?"); results = null; } Assert.IsTrue(results != null && results.Count > 0); }
public void TestGetProfilePhotosLogic() { ProfilePhotos results = new ProfilePhotos { ProfilePhotoList = new List<ProfilePhoto>() }; ProfilePhoto request = new ProfilePhoto { UserID = 137179126684623 }; LogHelper.LogInformation("Here we go..."); try { var logic = new ProfileLogic(); results = logic.GetPhotosByUserID(request); } catch (Exception ex) { LogHelper.LogError(ex, "What Happened?"); results = null; } Assert.IsTrue(results != null && results.ProfilePhotoList != null && results.ProfilePhotoList.Count > 0); }
public void TestGetPrimaryPhotoLogic() { ProfilePhoto result = new ProfilePhoto(); ProfilePhoto request = new ProfilePhoto { UserID = 137179126684623 }; LogHelper.LogInformation("Here we go..."); try { var logic = new ProfileLogic(); result = logic.GetPrimaryProfilePhoto(request); } catch (Exception ex) { LogHelper.LogError(ex, "What Happened?"); result = null; } Assert.IsTrue(result != null); }