public ProfilePage() { InitializeComponent(); _viewModel = new MyProfileViewModel(); BindingContext = _viewModel; _viewModel.ImageStatus = ImageStatusDefault; }
public MilestonePage(RootPage root, MyProfileViewModel profileViewModel) { try { InitializeComponent(); _model = new MilestoneViewModel(App.CurrentApp.MainPage.Navigation) { Root = root, ProfileViewModel = profileViewModel }; this.Init(); //Device.BeginInvokeOnMainThread(async () => //{ // // Works // await DisplayAlert("Testing!", "Some text", "OK"); // // Does not work // await DisplayActionSheet("Test", "Cancel", "Destroy", new[] {"1", "2"}); //}); } catch (Exception ex) { throw new NotImplementedException(ex.Message); } }
public MilestonePage(RootPage root, MyProfileViewModel profileViewModel) { try { InitializeComponent(); App.Configuration.InitialAsync(this); NavigationPage.SetHasNavigationBar(this, false); _model = new MilestoneViewModel(App.CurrentApp.MainPage.Navigation) { Root = root, ProfileViewModel = profileViewModel }; BindingContext = _model; //Device.BeginInvokeOnMainThread(async () => //{ // // Works // await DisplayAlert("Testing!", "Some text", "OK"); // // Does not work // await DisplayActionSheet("Test", "Cancel", "Destroy", new[] {"1", "2"}); //}); } catch (Exception ex) { DependencyService.Get <IMessage>().AlertAsync(TextResources.Alert, ex.InnerException != null ? ex.InnerException.Message : ex.Message, TextResources.Ok); } }
public void GetPostAuthor_ShouldWorkFine() { var author = new SimpleSocialUser { Id = "test", UserName = "******", }; var userManager = (UserManager <SimpleSocialUser>) this.Provider.GetService(typeof(UserManager <SimpleSocialUser>)); userManager.CreateAsync(author).GetAwaiter(); var post = new MyProfileViewModel { CreatePost = new CreatePostInputModel() { UserId = author.Id, Content = "Post", WallId = "wallId", } }; this.PostServices.CreatePost(post); var postId = this.PostsRepository.All().FirstOrDefault(x => x.UserId == author.Id).Id; var postAuthor = this.PostServices.GetPostAuthor(postId); postAuthor.Id.ShouldBe(author.Id); }
public ActionResult UpdateProfile() { int id = (int)Session["admin"]; var admin = _context.GetAdmin(id); var adminDetails = _context.GetUserProfileDetails(id); MyProfile Adminmodel = new MyProfile { Id = admin.ID, FirstName = admin.FirstName, LastName = admin.LastName, Email = admin.EmailID, PhoneNumber = adminDetails.PhoneNumber, CountryCodeId = adminDetails.PhoneNumberCounrtyCode }; MyProfileViewModel model = new MyProfileViewModel { Admin = Adminmodel, Countries = _context.GetCountries() }; return(View(model)); }
public ActionResult EditProfile() { var currentUser = User.Identity.GetUserId(); var user = _context.Users.Include(u => u.Organization).SingleOrDefault(u => u.Id == currentUser); var userProfilePic = _context.ProfileImages.OrderByDescending(pi => pi.Id).FirstOrDefault(pi => pi.UserId == user.Id); if (user == null) { throw new ArgumentNullException(); } var viewModel = new MyProfileViewModel { FirstName = user.FirstName, LastName = user.LastName, Email = user.Email, Organization = _context.Organizations.ToList(), OrganizationId = user.OrganizationId, OrganizationName = user.Organization.Name, PhoneNumber = user.PhoneNumber, DriversLicense = user.DriversLicense, ImagePath = _context.ProfileImages.OrderByDescending(pi => pi.Id).FirstOrDefault(pi => pi.UserId == user.Id).Path, Image = userProfilePic }; return(View(viewModel)); }
public ActionResult MyProfile() { Teacher teacher = Context.Teachers.SingleOrDefault(t => t.Email == Email); Student student = Context.Students.SingleOrDefault(s => s.Email == Email); if (teacher != null) { MyProfileViewModel mpvm = new MyProfileViewModel { FirstName = teacher.FirstName, LastName = teacher.LastName, Email = teacher.Email, School = teacher.School, Password = teacher.Password }; return(View("MyProfile_Teacher", mpvm)); } else { MyProfileViewModel mpvm = new MyProfileViewModel { FirstName = student.FirstName, LastName = student.LastName, Email = student.Email, School = student.School, Password = student.Password }; return(View("MyProfile_Student", mpvm)); } }
public LogDetailPage(MyProfileViewModel model) { InitializeComponent(); App.Configuration.InitialAsync(this); NavigationPage.SetHasNavigationBar(this, false); _model = model; Init(); }
protected async override void OnAppearing() { Analytics.TrackEvent("MyProfilePage"); base.OnAppearing(); //Workaround here BindingContext = viewModel = Startup.ServiceProvider?.GetService <MyProfileViewModel>() ?? new MyProfileViewModel(); await Refresh(); }
public ActionResult HobbiesAndPersonalities(int Id) { SussexDBEntities db = new SussexDBEntities(); MyProfileViewModel viewModel = new MyProfileViewModel(); viewModel.User = db.Users.Where(w => w.UserId == Id).FirstOrDefault(); return(View(viewModel)); }
public virtual async Task <ActionResult> MyProfile() { var vm = new MyProfileViewModel() { Email = this.HttpContext.User.Identity.Name }; return(View(vm)); }
public ActionResult MyProfile(MyProfileViewModel model) { if (ModelState.IsValid) { return(View()); } // If we got this far, something failed, redisplay form return(View(model)); }
public ActionResult MyProfile() { int userId = Int32.Parse(Session["UserId"].ToString()); SussexDBEntities db = new SussexDBEntities(); MyProfileViewModel viewModel = new MyProfileViewModel(); viewModel.User = db.Users.Where(w => w.UserId == userId).FirstOrDefault(); return(View(viewModel)); }
private void InitBinding() { ServerService.sendFriendMainFrm = RecvData; ProfileNickNameText.DataContext = MyProfileViewModel.GetInstance(); ProfileIntroduceText.DataContext = MyProfileViewModel.GetInstance(); FriendTreeView.ItemsSource = FriendTreeViewModel.GetInstance(); MyProfileViewModel.GetInstance().NickName = FriendWindowEntity.GetInstance().NickName; MyProfileViewModel.GetInstance().Introduce = FriendWindowEntity.GetInstance().Introduce; }
public async Task <IActionResult> MyProfile([FromForm] MyProfileViewModel myProfileViewModel) { var user = await _userManager.FindByIdAsync(myProfileViewModel.Id); user.Email = myProfileViewModel.Email; user.UserName = myProfileViewModel.UserName; user.PhoneNumber = myProfileViewModel.PhoneNumber; await _userManager.UpdateAsync(user); return(View(myProfileViewModel)); }
public async Task <IActionResult> Profile() { ViewBag.Title = "ASP.NET Drinks - My Profile"; var user = await _userManager.FindByNameAsync(HttpContext.User.Identity.Name); var myProfileViewModel = new MyProfileViewModel { UserName = user.UserName, Email = user.Email }; return(View(myProfileViewModel)); }
// GET: MyProfile public ActionResult Index() { if (TempData["error"] != null) { ViewBag.error = TempData["error"]; } if (TempData["status"] != null) { ViewBag.status = TempData["status"]; } var uId = User.Identity.GetUserId(); UserService userService = new UserService(); // UserViewModel roles = await GetUserRoles(uId); var user = userService.GetUserWithId(uId); MyProfileViewModel usvm = new MyProfileViewModel(); usvm.ReportingManagerId = user.ReportingManager; usvm.FirstName = user.Firstname; usvm.LookupGender = user.LookupGender; usvm.LastName = user.LastName; usvm.Email = user.Email; usvm.UserName = user.UserName; usvm.Id = user.Id; usvm.PhoneNumber = user.PhoneNumber; usvm.IsActive = user.IsActive; if (usvm.ReportingManagerId != null) { var rm = userService.GetUserWithId(usvm.ReportingManagerId); usvm.ReportingManagerUsername = rm.Firstname + " " + rm.LastName + " (" + rm.UserName + ")"; } //usvm.HrRole = roles.HrRole; //usvm.ContractRole = roles.ContractRole; //usvm.InventoryRole = roles.InventoryRole; //usvm.RecruitmentRole = roles.RecruitmentRole; //usvm.TimeSheetRole = roles.TimeSheetRole; //usvm.EmployeeRole = roles.EmployeeRole; usvm.JoiningDate = user.JoiningDate; usvm.EmployeeCode = user.EmployeeCode; usvm.GenderList = GetDropDownList("Gender", null); return(View(usvm)); }
public JsonResult EditProfile(MyProfileViewModel emp) { bool success = profile.saveChanges(emp); if (success) { return(Json(new { success = true, message = "Updated Successfully!" })); } else { return(Json(new { success = false, message = "Operation Failed!" })); } }
public PictureGalleryPage(MyProfileViewModel model) { try { InitializeComponent(); _model = model; Init(); } catch (Exception ex) { DependencyService.Get <IMessage>().AlertAsync(TextResources.Alert, ex.InnerException != null ? ex.InnerException.Message : ex.Message, TextResources.Ok); } }
public void CreatePost(MyProfileViewModel viewModel) { var post = new Post { UserId = viewModel.CreatePost.UserId, Title = viewModel.CreatePost.Title, WallId = viewModel.CreatePost.WallId, Content = viewModel.CreatePost.Content, }; postRepository.AddAsync(post).GetAwaiter().GetResult(); postRepository.SaveChangesAsync().GetAwaiter().GetResult(); }
public IActionResult Create(MyProfileViewModel viewModel) { if (ModelState.IsValid) { postServices.CreatePost(viewModel); return(RedirectToAction("MyProfile", "Account")); } else { var result = this.View("Error", this.ModelState); result.StatusCode = (int)HttpStatusCode.BadRequest; return(result); } }
public async Task <IActionResult> Index() { var user = await _userManager.FindByNameAsync(User.Identity.Name); MyProfileViewModel model = new MyProfileViewModel { AppUser = user, UserAuctionProducts = _context.UserAuctionProducts.Where(x => x.AppUserId == user.Id) .Include(x => x.AuctionProduct) .ThenInclude(x => x.AuctionProductGalleries).ToList() }; return(View(model)); }
public async Task CreatePost(MyProfileViewModel viewModel) { var post = new Post { UserId = viewModel.CreatePost.UserId, Title = viewModel.CreatePost.Title, WallId = viewModel.CreatePost.WallId, Content = viewModel.CreatePost.Content, }; await dbContext.AddAsync(post); await dbContext.SaveChangesAsync(); }
public MyProfileViewModel GetUserProfile() { MyProfileViewModel myProfileViewModel = new MyProfileViewModel(); string userId = System.Web.HttpContext.Current.User.Identity.GetUserId(); AspNetUsers aspNetUsers = db.AspNetUsers.Find(userId); myProfileViewModel.Id = aspNetUsers.Id; myProfileViewModel.Email = aspNetUsers.Email == null ? "" : aspNetUsers.Email; myProfileViewModel.Gender = aspNetUsers.Gender == null ? "" : aspNetUsers.Gender; myProfileViewModel.Name = aspNetUsers.Name == null ? "" : aspNetUsers.Name; myProfileViewModel.Username = aspNetUsers.UserName == null ? "" : aspNetUsers.UserName; myProfileViewModel.ProfilePicture = aspNetUsers.ProfilePicture == null ? "" : aspNetUsers.ProfilePicture; myProfileViewModel.ProfilePicturePath = aspNetUsers.ProfilePicturePath == null ? "" : aspNetUsers.ProfilePicturePath; return(myProfileViewModel); }
public ActionResult Index() { using (var client = new HttpClient()) { var getPastOrderUrl = "https://mtsk-proje.herokuapp.com/api/order/"; var getUserInformationUrl = "https://mtsk-proje.herokuapp.com/api/users/"; client.DefaultRequestHeaders.Add("Authorization", "Bearer " + Session["token"]); var getUserInformationResponse = client.GetStringAsync(getUserInformationUrl); var getPastOrderResponse = client.GetStringAsync(getPastOrderUrl); MyProfileViewModel message = new MyProfileViewModel(); message.getPastOrderResponseMessage = JsonConvert.DeserializeObject <GetPastOrderResponseMessage>(getPastOrderResponse.Result); message.getUserInformationResponseMessage = JsonConvert.DeserializeObject <GetUserInformationResponseMessage>(getUserInformationResponse.Result); return(View(message)); } }
public ConfirmEmailTemplate GetConfirmEmailChangingTemplate(MyProfileViewModel model, string callbackUrl) { string websiteName = generalFunction.GetAppSettingsValue("websiteName"); var link = "<a href='" + callbackUrl + "'>here</a>"; string body = "<p>Hi " + model.Username + ",<br /><br /> We have received a request to change your email address for your account in " + websiteName + ".</p><p>Please confirm your account by clicking <a href='" + callbackUrl + "'> here</a></p>" + "<p>If you did not do so, please ignore this email.</p>" + "<p><i>Do not reply to this email.</i></p><br /><br /><p>Regards,<br>" + websiteName + "</p>"; string subject = "Confirm Email for Changing Email Address of an Account in " + websiteName; ConfirmEmailTemplate confirmEmailTemplate = new ConfirmEmailTemplate(); confirmEmailTemplate.Subject = subject; confirmEmailTemplate.Body = body; return(confirmEmailTemplate); }
public static void Init() { MyProfileViewModel = new MyProfileViewModel { ImageFilePath = FileManager.MyProfileImagePath, #if DEBUG FullName = "Linda Jones", Nickname = "The Queen", Mobile = "0412 345 678", Email = "*****@*****.**" #endif }; LocalStateStore = new LocalStateStore(); }
public IActionResult PostComment(MyProfileViewModel inputModel) { if (!ModelState.IsValid) { var result = this.View("Error", this.ModelState); ViewData["Message"] = ErrorConstants.SomethingWentWrongError; result.StatusCode = (int)HttpStatusCode.BadRequest; return(result); } var commentInputModel = inputModel.CommentInputModel; this.commentsServices.CreateComment(commentInputModel); return(RedirectToAction("PostDetails", "Posts", new { id = inputModel.CommentInputModel.PostId })); }
public void GetUserPosts_ShouldReturnAll() { var user = new SimpleSocialUser { Id = "test", UserName = "******", }; var user2 = new SimpleSocialUser { Id = "secondUser", UserName = "******" }; var userManager = (UserManager <SimpleSocialUser>) this.Provider.GetService(typeof(UserManager <SimpleSocialUser>)); userManager.CreateAsync(user).GetAwaiter(); userManager.CreateAsync(user2).GetAwaiter(); var post = new MyProfileViewModel { CreatePost = new CreatePostInputModel() { UserId = user.Id, Content = "Post", WallId = "wallId", } }; var postForSecondUser = new MyProfileViewModel { CreatePost = new CreatePostInputModel() { UserId = user2.Id, Content = "Post2", WallId = "wallId2", } }; this.PostServices.CreatePost(postForSecondUser); this.PostServices.CreatePost(post); this.PostServices.CreatePost(post); this.PostServices.CreatePost(post); var userPostsCount = this.PostServices.GetUserPosts(user.Id, "1", 0).Count; userPostsCount.ShouldBe(3); }
public void Fill(ProfileInformationDTO profileInfo) { updateOfflineGuid(); if (profileInfo != null) { DataContext = new MyProfileViewModel(profileInfo); //retrieve latest messages ((MyProfileViewModel)DataContext).LoadMessages(); //lblPoints.Text = profileInfo.Licence.BAPoints.ToString(); ctrlAwards.User = profileInfo.User; fillImage(); } else { DataContext = null; } }
public ActionResult UpdateProfile(MyProfileViewModel model) { if (this.ModelState.IsValid) { var userId = User.Identity.GetUserIdAsInt(); using (var context = new DataContext()) { var user = (from x in context.Users.Include(u => u.Profile) where x.Id == userId select x).FirstOrDefault(); if (user != null) { user.FirstName = model.FirstName; user.MiddleName = model.MiddleName; user.LastName = model.LastName; user.DateOfBirth = model.DateOfBirth; user.Gender = model.Gender; user.PhoneNumber = model.Telephone; user.Email = model.Email; user.Profile.DojoId = model.DojoId; user.Profile.RankId = model.RankId; if (!string.IsNullOrEmpty(model.AddressLine1) || !string.IsNullOrEmpty(model.AddressLine2) || !string.IsNullOrEmpty(model.City) || !string.IsNullOrEmpty(model.ZipCode) || !string.IsNullOrEmpty(model.State)) { if (user.Profile.Address == null) { user.Profile.Address = new Address(); } user.Profile.Address.AddressLine1 = model.AddressLine1; user.Profile.Address.AddressLine2 = model.AddressLine2; user.Profile.Address.City = model.City; user.Profile.Address.State = model.State; user.Profile.Address.ZipCode = model.ZipCode; } context.SaveChanges(); ViewBag.EditResult = "Profile Saved"; } } } // If we got this far, something failed, redisplay form return this.View("Index", model); }
public ActionResult MyProfile(int page = 1) { if (LayoutViewModel.IsSuplier) { return RedirectToAction("Dashboard", "Supplier"); } if (LayoutViewModel.IsCouncil) { return RedirectToAction("Index", "ChallengesAdmin"); } LayoutViewModel.ActiveLink = Links.AccountMyProfile; //Code to change user password from the code //string username = membershipUser.UserName; //string password = "******"; //MembershipUser mu = Membership.GetUser(username); //mu.ChangePassword(mu.ResetPassword(), password); ProfileModel profileModel = new ProfileService().GetMyProfile( LayoutViewModel.ProviderUserKey, LayoutViewModel.CurrentUserEmail, page); MyProfileViewModel viewModel = new MyProfileViewModel(); viewModel.ProfileModel = profileModel; viewModel.EmailAddress = LayoutViewModel.CurrentUserEmail; //TODO - fix this viewModel.HouseholdMemberModel = new HouseholdMemberModel(); if (profileModel.User.DateOfBirth != null) { viewModel.BirthDate = profileModel.User.DateOfBirth.Value.ToString("dd MMM yyyy"); } //Auspost specific if (LayoutViewModel.IsAusPost) { if (profileModel.User.DateOfBirth != null) { viewModel.BirthDate = profileModel.User.DateOfBirth.Value.ToString("dd MMM yyyy"); var numOfYears = DateTime.Today.Year - profileModel.User.DateOfBirth.Value.Year; const int interval = 8; string range = CheckValueInRange(0, 17, numOfYears) ? "< 18" : (CheckValueInRange(18, interval, numOfYears) ? "18-25" : (CheckValueInRange(26, interval, numOfYears) ? "26-33" : (CheckValueInRange(34, interval, numOfYears) ? "34-41" : (CheckValueInRange(42, interval, numOfYears) ? "42-49" : (CheckValueInRange(50, interval, numOfYears) ? "50-57" : (CheckValueInRange(58, interval, numOfYears) ? "58-65" : (CheckValueInRange(66, interval, numOfYears) ? "66-73" : "74 >" ))))))); viewModel.NumberOfYears = String.Format("{0} years", range); } viewModel.NumberOfChallenges = new ChallengesService().GetNumberOfMyChallenges(LayoutViewModel.ProviderUserKey, DateTime.Today.AddMonths(-12)); return View("MyProfileAuspost", viewModel); } viewModel.AddressFull = ViewModelHelper.GetUserAddress(profileModel.Address); return View(viewModel); }