Esempio n. 1
0
        public async Task <ActionResult> EditPhoneNumber(string phoneNumber)
        {
            if (ModelState.IsValid)
            {
                FoodshareDbContext db = new FoodshareDbContext();

                var userId = User.Identity.GetUserId();

                var user = db.Users.Where(x => x.Id == userId).Single();
                user.PhoneNumber = phoneNumber;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View((object)phoneNumber));
        }