public virtual async Task <ActionResult> UserProfile ([Bind(Include = "ID,FirstName,LastName,Mobile,Address")] ProfileViewmodel userprofile) { if (!ModelState.IsValid) { return(View(userprofile)); } var user = await _userManager.FindByNameAsync(User.Identity.Name); if (user != null) { user.FirstName = userprofile.FirstName; user.LastName = userprofile.LastName; user.Mobile = userprofile.Mobile; user.Address = userprofile.Address; await _userManager.UpdateAsync(user); await _unitOfWork.SaveAllChangesAsync(); } else { return(View(userprofile)); } return(RedirectToAction("Index", new { Message = ManageMessageId.UserProfileSuccessfully })); }
public async Task <IActionResult> Create([Bind("Id,Description,Icon")] ProfileViewmodel Vm) { if (ModelState.IsValid) { var Res = _Mapper.Map <ProfilesMaster>(Vm); // await _profileRepository.SaveOrUpdateAsync(Res); return(RedirectToAction(nameof(Index))); } return(View(Vm)); }
public ProfileView() { this.InitializeComponent(); Loading += ProfileView_Loading; ViewModel = new ProfileViewmodel(); this.DataContext = ViewModel; NavigationCacheMode = NavigationCacheMode.Enabled; }
public ActionResult Index() { var model = new ProfileViewmodel() { UserVerified = _membership.CurrentUser.IsVerified, UserClients = _clientManager.GetByUserId(_membership.CurrentUser.Id).ToList() }; ViewBag.PaymentPublishableKey = ConfigurationManager.AppSettings["StripePublishableKey"]; return(View(model)); }
public ProfileView() { this.InitializeComponent(); ViewModel = new ProfileViewmodel(); this.DataContext = ViewModel; //Listening for Sign In message Messenger.Default.Register <User>(this, ViewModel.RecieveSignInMessage); //Listening for Sign Out message Messenger.Default.Register <GlobalHelper.SignOutMessageType>(this, ViewModel.RecieveSignOutMessage); NavigationCacheMode = NavigationCacheMode.Enabled; }
// GET: Profiles/Edit/5 public async Task <IActionResult> Edit(int?id, ProfileViewmodel vm) { if (id == null) { return(NotFound()); } var profile = await _profileRepository.GetByIdAsync(id); _Mapper.Map(vm, profile); if (profile == null) { return(NotFound()); } return(View(profile)); }