Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using capaDALC;
- namespace capaLogicaNegocio
- {
- public class CL_Usuario
- {
- private string _usuario;
- private string _password;
- private string _nombre;
- private string _apellido;
- public string Usuario
- {
- get
- {
- return _usuario;
- }
- set
- {
- _usuario = value;
- }
- }
- public string Password
- {
- get
- {
- return _password;
- }
- set
- {
- _password = value;
- }
- }
- public string Nombre
- {
- get
- {
- return _nombre;
- }
- set
- {
- _nombre = value;
- }
- }
- public string Apellido
- {
- get
- {
- return _apellido;
- }
- set
- {
- _apellido = value;
- }
- }
- private CL_Contexto conexion;
- public CL_Usuario()
- {
- conexion = new CL_Contexto();
- }
- public CL_Usuario validarUsuario()
- {
- try
- {
- Usuario userBD = conexion.Entidades.Usuario.First(x => x.UserName == this.Usuario && x.Password == this.Password);
- return new CL_Usuario() { Nombre = userBD.Nombres, Apellido = userBD.Apellidos }; //se retorna un usuario con el nombre cargado
- }
- catch (Exception ex)
- {
- return null;
- throw new Exception("Error al validar usuario" + ex.Message);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment