コード例 #1
0
        public JsonResult EditUser(string userName, string firstName, string lastName, string houseId, string phonenumber, string email, bool isAdmin, string userId)
        {
            IDatabaseAdapter adapter = DatabaseAdapter.Instance();
            IUser            us      = adapter.GetUserById(new Guid(userId));

            User updatedUser = new User();

            updatedUser.UserId    = us.UserId;
            updatedUser.FirstName = firstName;;
            updatedUser.LastName  = lastName;
            updatedUser.PhoneNo   = phonenumber;
            updatedUser.HouseId   = new Guid(houseId);
            updatedUser.Username  = userName;
            updatedUser.Email     = email;
            updatedUser.IsAdmin   = isAdmin;

            try
            {
                return(Json(adapter.EditUser(updatedUser)));
            }
            catch
            {
                return(Json("User not edited"));
            }
        }