Exemplo n.º 1
0
        public bool Eliminar(UserDatosModel model)
        {
            var user = db.Users.Single(x => x.IdUser == model.Id);

            db.Users.DeleteOnSubmit(user);

            db.SubmitChanges();

            return(true);
        }
Exemplo n.º 2
0
        public bool Actualizar(UserDatosModel model)
        {
            var user = db.Users.Single(x => x.IdUser == model.Id);

            user.Email    = model.Email;
            user.LastName = model.LastName;
            user.Name     = model.Name;
            user.Password = model.Password;
            user.UserName = model.User;

            db.SubmitChanges();

            return(true);
        }
Exemplo n.º 3
0
        public UserDatosModel EditDatos(int id)
        {
            var user = db.Users.SingleOrDefault(u => u.IdUser == id);

            var datos = new UserDatosModel()
            {
                Email    = user.Email,
                Id       = user.IdUser,
                LastName = user.LastName,
                Name     = user.Name,
                Password = user.Password,
                User     = user.UserName
            };

            return(datos);
        }
Exemplo n.º 4
0
        public List <UserDatosModel> UserDatos()
        {
            List <UserDatosModel> userList = new List <UserDatosModel>();

            var users = db.Users.OrderBy(u => u.Name).ToList();

            foreach (var user in users)
            {
                var datos = new UserDatosModel()
                {
                    Name     = user.Name,
                    Password = user.Password,
                    LastName = user.LastName,
                    Email    = user.Email,
                    User     = user.UserName,
                    Id       = user.IdUser
                };

                userList.Add(datos);
            }

            return(userList);
        }