コード例 #1
0
        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 }));
        }
コード例 #2
0
 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));
 }
コード例 #3
0
        public ProfileView()
        {
            this.InitializeComponent();
            Loading  += ProfileView_Loading;
            ViewModel = new ProfileViewmodel();

            this.DataContext = ViewModel;

            NavigationCacheMode = NavigationCacheMode.Enabled;
        }
コード例 #4
0
        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));
        }
コード例 #5
0
        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;
        }
コード例 #6
0
        // 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));
        }