public IActionResult Iniciarsesion([FromBody] Iniciarsesion a) { try { return(Ok(al.InsertarUsuIniciarsesionario(a))); } catch (Exception e) { return(StatusCode(500, e)); } }
public bool InsertarUsuIniciarsesionario(Iniciarsesion a) { IDbCommand dbTransation; DynamicParameters parameters = new DynamicParameters(); parameters.Add("@user", a.user); parameters.Add("@pass", a.pass); using (IDbConnection db = GetConnection()) { db.Open(); try { string result = null; object value = db.ExecuteScalar("Usuario.Iniciarsesion", commandType: CommandType.StoredProcedure, param: parameters); if (value != null) { result = value.ToString(); return(true); } else { return(false); } db.Close(); } catch (Exception e) { db.Close(); return(false); throw e; } } }