示例#1
0
        public PreferencesDetails GetPreferencesDetails(int userId)
        {
            var assets             = DbContext.AssetsLists.ToList();
            var preferencesDetails = new PreferencesDetails
            {
                User     = DbContext.Users.First(i => i.uniqueId == userId),
                Requests = DbContext.TypeRequests.ToList(),
                Assets   = assets
            };

            return(preferencesDetails);
        }
        public ActionResult UpdatePreferences(PreferencesDetails details)
        {
            if (details.User.password != details.ConfirmPassword)
            {
                return(Content("Error the passwords do not match!"));
            }

            try
            {
                _repository.UpdateUsers(details.User);
                return(Content("Saved!"));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(Content("Not Updated " + e.Message));
            }
        }