コード例 #1
0
ファイル: NUsuario.cs プロジェクト: fredreyes/SGA
 public List <EAlumnos> ListaUsers()
 {
     try
     {
         DUsers          d             = new DUsers();
         List <EAlumnos> listaUsuarios = d.ListarUsers();
         return(listaUsuarios);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #2
0
        public async Task <IActionResult> Post([FromBody] DUsers model)
        {
            try
            {
                await _context.Users.AddAsync(model);

                await _context.SaveChangesAsync();

                return(Success("User added successfully.", null, model));
            }
            catch (Exception ex)
            {
                return(Error <object>("Something went wrong!", ex.Message, null));
            }
        }
コード例 #3
0
        public static string Insertar(string Email, string Nombre, string Password, bool Superuser)
        {
            DUsers Datos = new DUsers();

            string Existe = Datos.Existe(Email);

            if (Existe.Equals("1"))
            {
                return("El usuario con ese email ya existe.");
            }
            else
            {
                Users Obj = new Users();
                Obj.User_Names     = Nombre;
                Obj.User_Email     = Email;
                Obj.User_Password  = Password;
                Obj.User_SuperUser = Superuser;
                return(Datos.Insertar(Obj));
            }
        }
コード例 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            string url = "http://wx.70c.com/";
            Random rd = new Random();
            int strLength = rd.Next(3, 10);
            string userName = "", pwd = "", nick_name = "";
            for (int i = 0; i < strLength; i++)
            {
                userName += codeStr.Substring(rd.Next(0, codeStr.Length - 1), 1);
            }
            userName += emailList[rd.Next(0, emailList.Count - 1)];
            int pwdLength = rd.Next(3, 10);
            for (int i = 0; i < strLength; i++)
            {
                pwd += codeStr.Substring(rd.Next(0, codeStr.Length - 1), 1);
            }

            int nkLength = rd.Next(3, 8);
            for (int i = 0; i < strLength; i++)
            {
                nick_name += codeStr.Substring(rd.Next(0, codeStr.Length - 1), 1);
            }
            url += "Handler.ashx?cmd=Register&openID=&password="******"&nick_name=" + nick_name + "&email=" + userName;

            bool res = InterfaceHelper.Deserialize(InterfaceHelper.GetResult(url));
            if (res)
            {
                MUsers model = new MUsers();
                model.addtime = DateTime.Now;
                model.email = userName;
                model.nickname = nick_name;
                model.openid = "";
                model.pwd = pwd;
                DUsers d = new DUsers();
                d.InsertSQL(model);
            }
        }
コード例 #5
0
        public async Task <IActionResult> Put(Guid id, [FromBody] DUsers model)
        {
            try
            {
                var user = await _context.Users.FirstOrDefaultAsync(a => a.UserId == id);

                if (user == null)
                {
                    return(NotFound <object>("User not found.", "User not found in database.", null));
                }

                user.Name    = model.Name;
                user.Surname = model.Surname;
                user.Age     = model.Age;

                await _context.SaveChangesAsync();

                return(Success("User updated successfully.", null, model));
            }
            catch (Exception ex)
            {
                return(Error <object>("Something went wrong!", ex.Message, null));
            }
        }
コード例 #6
0
        public static DataTable Login(string Email, string Clave)
        {
            DUsers Datos = new DUsers();

            return(Datos.Login(Email, Clave));
        }
コード例 #7
0
 /// <summary>
 /// 创建用户
 /// </summary>
 public static int CreateUser(MUsers inModel)
 {
     return(DUsers.CreateUser(inModel));
 }
コード例 #8
0
 /// <summary>
 /// 根据用户名和密码获取用户
 /// </summary>
 public static MUsers GetUsers(string inUserName, string inPassword)
 {
     return(DUsers.GetUsers(inUserName, inPassword));
 }