示例#1
0
        public ContentResult AddNewUser(string user, string pwd)
        {
            // --------------------------------------------------------------
            try {
                int retval = info.AddNewUser(user, pwd);
                switch (retval)
                {
                case 0: return(Content("ok"));

                case 1: return(Content($"'{user}' is already in use"));

                default: return(Content("Error updating the database"));
                }
                ;
            }
            catch (Exception ex) {
                string msg = $"An error occurred adding the new user:\r\n{ex.Message}";
                return(Content(msg));
            }
        }