Update API-Token
This commit is contained in:
@@ -8,6 +8,7 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Runtime.Serialization.Formatters;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace API_NetFramework.Controllers
|
||||
@@ -26,12 +27,19 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
public IHttpActionResult GetGetAll(string OutFormat = "JSON")
|
||||
{
|
||||
Database.DB db = new Database.DB(connectionstring);
|
||||
string SQL = "Select * from Antwortadresse order by bezeichnung";
|
||||
if (OutFormat == "JSON") { SQL = SQL + " for json path"; }
|
||||
if (OutFormat == "XML") { SQL = SQL + " for xml path"; }
|
||||
db.Get_Tabledata(SQL, false, true);
|
||||
return Ok(db.dsdaten.Tables[0].Rows[0][0].ToString());
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request) ==false){
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
Database.DB db = new Database.DB(connectionstring);
|
||||
string SQL = "Select * from Antwortadresse order by bezeichnung";
|
||||
if (OutFormat == "JSON") { SQL = SQL + " for json path"; }
|
||||
if (OutFormat == "XML") { SQL = SQL + " for xml path"; }
|
||||
db.Get_Tabledata(SQL, false, true);
|
||||
return Ok(db.dsdaten.Tables[0].Rows[0][0].ToString());
|
||||
}
|
||||
catch (Exception e) { return Content(HttpStatusCode.InternalServerError, e.Message); }
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
@@ -46,12 +54,20 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
public IHttpActionResult GetByID(string ID,string OutFormat = "JSON")
|
||||
{
|
||||
Database.DB db = new Database.DB(connectionstring);
|
||||
string SQL = "Select * from Antwortadresse where id="+ID;
|
||||
if (OutFormat == "JSON") { SQL = SQL + " for json path"; }
|
||||
if (OutFormat == "XML") { SQL = SQL + " for xml path"; }
|
||||
db.Get_Tabledata(SQL, false, true);
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0) { return Ok(); } else { return Ok(db.dsdaten.Tables[0].Rows[0][0].ToString()); };
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
Database.DB db = new Database.DB(connectionstring);
|
||||
string SQL = "Select * from Antwortadresse where id=" + ID;
|
||||
if (OutFormat == "JSON") { SQL = SQL + " for json path"; }
|
||||
if (OutFormat == "XML") { SQL = SQL + " for xml path"; }
|
||||
db.Get_Tabledata(SQL, false, true);
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0) { return Ok(); } else { return Ok(db.dsdaten.Tables[0].Rows[0][0].ToString()); };
|
||||
}
|
||||
catch (Exception e) { return Content(HttpStatusCode.InternalServerError, e.Message); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -66,14 +82,20 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
public IHttpActionResult GetAllMitarbeiterByTGNummer(string tgnummer, string OutFormat = "JSON")
|
||||
{
|
||||
|
||||
|
||||
Database.DB db = new Database.DB(connectionstring);
|
||||
string SQL = "Select * from AntwortAdresse_Mitarbeiter where aktiv=1 and tgnummer='" + tgnummer + "' order by bezeichnung ";
|
||||
if (OutFormat == "JSON") { SQL = SQL + " for json path"; }
|
||||
if (OutFormat == "XML") { SQL = SQL + " for xml path"; }
|
||||
db.Get_Tabledata(SQL, false, true);
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0) { return Ok(); } else { return Ok(db.dsdaten.Tables[0].Rows[0][0].ToString()); };
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
Database.DB db = new Database.DB(connectionstring);
|
||||
string SQL = "Select * from AntwortAdresse_Mitarbeiter where aktiv=1 and tgnummer='" + tgnummer + "' order by bezeichnung ";
|
||||
if (OutFormat == "JSON") { SQL = SQL + " for json path"; }
|
||||
if (OutFormat == "XML") { SQL = SQL + " for xml path"; }
|
||||
db.Get_Tabledata(SQL, false, true);
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0) { return Ok(); } else { return Ok(db.dsdaten.Tables[0].Rows[0][0].ToString()); };
|
||||
}
|
||||
catch (Exception e) { return Content(HttpStatusCode.InternalServerError, e.Message); }
|
||||
}
|
||||
[HttpGet]
|
||||
[Route("API/API/AntwortAdresse/GetAllMitarbeiterByMitarbeiterNr")]
|
||||
@@ -87,12 +109,20 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
public IHttpActionResult GetAllMitarbeiterByMitarbeiterNr(string Mitarbeiternr, string OutFormat = "JSON")
|
||||
{
|
||||
Database.DB db = new Database.DB(connectionstring);
|
||||
string SQL = "Select * from AntwortAdresse_Mitarbeiter where aktiv=1 and Mitarbeiternr='" + Mitarbeiternr + "' ";
|
||||
if (OutFormat == "JSON") { SQL = SQL + " for json path"; }
|
||||
if (OutFormat == "XML") { SQL = SQL + " for xml path"; }
|
||||
db.Get_Tabledata(SQL, false, true);
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0) {return Ok();} else {return Ok(db.dsdaten.Tables[0].Rows[0][0].ToString());};
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
Database.DB db = new Database.DB(connectionstring);
|
||||
string SQL = "Select * from AntwortAdresse_Mitarbeiter where aktiv=1 and Mitarbeiternr='" + Mitarbeiternr + "' ";
|
||||
if (OutFormat == "JSON") { SQL = SQL + " for json path"; }
|
||||
if (OutFormat == "XML") { SQL = SQL + " for xml path"; }
|
||||
db.Get_Tabledata(SQL, false, true);
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0) { return Ok(); } else { return Ok(db.dsdaten.Tables[0].Rows[0][0].ToString()); };
|
||||
}
|
||||
catch (Exception e) { return Content(HttpStatusCode.InternalServerError, e.Message); }
|
||||
}
|
||||
|
||||
|
||||
@@ -108,12 +138,20 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
public IHttpActionResult GetMitarbeiterByID(string ID, string OutFormat = "JSON")
|
||||
{
|
||||
Database.DB db = new Database.DB(connectionstring);
|
||||
string SQL = "Select * from AntwortAdresse_Mitarbeiter where id=" + ID;
|
||||
if (OutFormat == "JSON") { SQL = SQL + " for json path"; }
|
||||
if (OutFormat == "XML") { SQL = SQL + " for xml path"; }
|
||||
db.Get_Tabledata(SQL, false, true);
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0) { return Ok(); } else { return Ok(db.dsdaten.Tables[0].Rows[0][0].ToString()); };
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
Database.DB db = new Database.DB(connectionstring);
|
||||
string SQL = "Select * from AntwortAdresse_Mitarbeiter where id=" + ID;
|
||||
if (OutFormat == "JSON") { SQL = SQL + " for json path"; }
|
||||
if (OutFormat == "XML") { SQL = SQL + " for xml path"; }
|
||||
db.Get_Tabledata(SQL, false, true);
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0) { return Ok(); } else { return Ok(db.dsdaten.Tables[0].Rows[0][0].ToString()); };
|
||||
}
|
||||
catch (Exception e) { return Content(HttpStatusCode.InternalServerError, e.Message); }
|
||||
}
|
||||
[HttpGet]
|
||||
[Route("API/API/AntwortAdresse/GetMitarbeiterUndStandard")]
|
||||
@@ -127,16 +165,27 @@ namespace API_NetFramework.Controllers
|
||||
/// public IHttpActionResult GetMitarbeiterByID(string ID, string OutFormat = "JSON")
|
||||
public IHttpActionResult GetGASAdressen_Einzeilig(string TGNummer, string OutFormat = "JSON")
|
||||
{
|
||||
Database.DB db = new Database.DB(connectionstring);
|
||||
db.clear_parameter();
|
||||
db.add_parameter("@tgnummer", TGNummer);
|
||||
db.add_parameter("@format",OutFormat);
|
||||
db.Get_Tabledata("sp_get_gas_einzeilig", true, false);
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0) {
|
||||
return Content(HttpStatusCode.NotFound, "");
|
||||
}
|
||||
else {
|
||||
return Content(HttpStatusCode.OK,db.dsdaten.Tables[0].Rows[0][0].ToString()); };
|
||||
if (SecuringWebApiUsingApiKey.Middleware.ApiKeyMiddleware.Authorized((HttpRequestMessage)Request) == false)
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
}
|
||||
try
|
||||
{
|
||||
Database.DB db = new Database.DB(connectionstring);
|
||||
db.clear_parameter();
|
||||
db.add_parameter("@tgnummer", TGNummer);
|
||||
db.add_parameter("@format", OutFormat);
|
||||
db.Get_Tabledata("sp_get_gas_einzeilig", true, false);
|
||||
if (db.dsdaten.Tables[0].Rows.Count == 0)
|
||||
{
|
||||
return Content(HttpStatusCode.NotFound, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
return Content(HttpStatusCode.OK, db.dsdaten.Tables[0].Rows[0][0].ToString());
|
||||
};
|
||||
}
|
||||
catch (Exception e) { return Content(HttpStatusCode.InternalServerError, e.Message); }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user