Esempio n. 1
0
        public async Task <IActionResult> Remove(int productId)
        {
            int?userId = _userIdentity.GetCurrentId();

            if (userId == null)
            {
                return(BadRequest());
            }

            await _users.RemoveFromWishlistAsync(userId.Value, productId);

            return(RedirectToAction(nameof(Index)));
        }
Esempio n. 2
0
        public async Task <IActionResult> EditProfile(ProfileVM model)
        {
            if (!ModelState.IsValid)
            {
                return(View(nameof(Index), model));
            }

            int?userId = _userIdentity.GetCurrentId();

            if (userId == null)
            {
                return(NotFound());
            }

            await _users.UpdateUserProfile(userId.Value, model.EditProfileVM.FirstName, model.EditProfileVM.LastName, model.EditProfileVM.EmailAddress, model.EditProfileVM.PhoneNumber);

            TempData["SuccessTitle"] = "Profile Updated";
            TempData["SuccessBody"]  = "Your profile has been updated successfully.";
            return(RedirectToAction(nameof(Index)));
        }