Esempio n. 1
0
        internal void SaveUser(UserView user)
        {
            HttpWebResponse response;
            HttpWebRequest  request;

            if (user.IsNew)
            {
                request = GetServiceRequest("users", "POST");
            }
            else
            {
                request = GetServiceRequest(string.Format("users/{0}", user.ID), "PUT");
            }


            string body = Serialize(user.GetUser());

            request.ContentLength = body.Length;
            SetBody(ref request, body);


            try
            {
                response = (HttpWebResponse)request.GetResponse();
            }
            catch (WebException ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
        internal void SaveUser(UserView user)
        {
            foreach (var permission in user.AssignedPermissions)
            {
                foreach (var permissionType in permission.Value)
                {
                    permissionType.PermissionType = string.Format("menu:{0}", permissionType.PermissionType);
                }
            }
            HttpWebResponse response;
            HttpWebRequest  request;

            if (user.IsNew)
            {
                request = GetServiceRequest("users", "POST");
            }
            else
            {
                request = GetServiceRequest(string.Format("users/{0}", user.ID), "PUT");
            }
            string body = Serialize(user.GetUser());

            request.ContentLength = body.Length;
            SetBody(ref request, body);
            try
            {
                response = (HttpWebResponse)request.GetResponse();
            }
            catch (WebException ex)
            {
                throw ex;
            }
        }
Esempio n. 3
0
 public UserItem Get(Guid id)
 {
     return(_userView.GetUser(id));
 }