public OkResult Login(LoginViewModel login)
 {
     try
     {
         using (var tran = new DB_PrestAppContext())
         {
             byte[] Encrypted = Encoding.UTF8.GetBytes(login.passwd);
             var    success   = tran.Set <ClUsuarios>().Select(x => x).Where(x => x.Usu_Nombre == login.user && x.Usu_Clave == Encrypted).FirstOrDefault();
             if (success != null)
             {
                 return(Ok());
             }
             else
             {
                 throw new Exception("Credenciales incorrectas.");
             }
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Example #2
0
 public CRUDModel(DB_PrestAppContext _context)
 {
     this.dataContext = _context;
     dbSet            = _context.Set <T>();
 }
Example #3
0
#pragma warning restore IDE0044 // Add readonly modifier

        public CRUDModel()
        {
            this.dataContext = new DB_PrestAppContext();
            dbSet            = dataContext.Set <T>();
        }