Ejemplo n.º 1
0
        public IActionResult ChangeUserPreferences(int id, string country, string city, string theme, string technologyAreas, string alignment, int?rating)
        {
            UserPreferences found = _context.UserPreferences.Find(id);

            if (found != null)
            {
                found.Country               = country;
                found.City                  = city;
                found.Theme                 = theme;
                found.TechArea              = technologyAreas;
                found.Alignment             = alignment;
                found.Rank                  = rating;
                _context.Entry(found).State = EntityState.Modified;
                _context.Update(found);
                _context.SaveChanges();
            }
            return(RedirectToAction("InvestmentsIndex", found));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PutUser(int id, User user)
        {
            user.UserId = id;

            context.Entry(user).State = EntityState.Modified;

            try
            {
                await context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!UserExists(user.UserId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }