Esempio n. 1
0
        public async Task <ActionResult> Index(IndexViewModel model)
        {
            var currentUser = await GetCurrentUser();

            if (ModelState.IsValid)
            {
                var currentUserClosure = currentUser;
                var dbUser             = await Db.Users.FirstOrDefaultAsync(x => x.Id == currentUserClosure.Id);

                dbUser.Email = model.Email;
                dbUser.SummaryMailInterval = model.SummaryMailInterval;
                await Db.SaveChangesAsync();
            }

            // reload user
            currentUser = await GetCurrentUser();

            return(View(model.Fill(currentUser)));
        }