Esempio n. 1
0
        /// <summary>
        /// Adds a user to the database
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public FOEResult <User> AddUser(string userName, string password, string email)
        {
            FOEResult <User> result = new FOEResult <User>();

            try
            {
                ServiceRequestHandler requestHandler = new ServiceRequestHandler();
                result.Result = requestHandler.AddUser(userName, password, email);
            }
            catch (FOEServiceException ex)
            {
                Trace.TraceError("{0}", ex);
                result = new FOEResult <User>(ex);
            }
            catch (SqlException ex)
            {
                Trace.TraceError("{0}", ex);
                result = new FOEResult <User>(FOEStatusCodes.DatabaseError, ex.Message);
            }
            catch (Exception ex)
            {
                Trace.TraceError("{0}", ex);
                result = new FOEResult <User>(FOEStatusCodes.InternalError, ex.Message);
            }
            return(result);
        }