Update nach User-Passwort-Change
This commit is contained in:
106
CoreWebAPI1/Controllers/AspNetRoles.cs
Normal file
106
CoreWebAPI1/Controllers/AspNetRoles.cs
Normal file
@@ -0,0 +1,106 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using CoreWebAPI1.Models;
|
||||
using BWPMModels;
|
||||
using System.Data;
|
||||
using SecuringWebApiUsingApiKey.Attributes;
|
||||
|
||||
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
|
||||
namespace CoreWebAPI1.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
|
||||
public class AspNetRolesController : ControllerBase
|
||||
{
|
||||
// GET: api/<AspNetRolesController>
|
||||
[HttpGet]
|
||||
public List<AspNetRoles> Get()
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
//dbh.Get_Tabledata("Select * from [AspNetRoles]", false, true);
|
||||
|
||||
List<BWPMModels.AspNetRoles> Details = new List<BWPMModels.AspNetRoles>();
|
||||
return dbh.ConvertDataTable<BWPMModels.AspNetRoles>(dbh.Get_Tabledata("Select * from [AspNetRoles]", false, true));
|
||||
}
|
||||
|
||||
|
||||
// GET api/<AspNetRolesController>/5
|
||||
[HttpGet("{id}")]
|
||||
public List<AspNetRoles> Get(int id)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
List<AspNetRoles> Details = new List<AspNetRoles>();
|
||||
return dbh.ConvertDataTable<AspNetRoles>(dbh.Get_Tabledata("Select * from [AspNetRoles] where id=" + id.ToString(), false, true));
|
||||
}
|
||||
|
||||
// POST api/<AspNetRolesController>
|
||||
[HttpPost]
|
||||
public void Post([FromBody] AspNetRoles AspNetRoles)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabeldata_for_Update("Select top 1 * from [AspNetRoles] where id=-1", false, true);
|
||||
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
|
||||
AspNetRoles.GetType().GetProperties().ToList().ForEach(f =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (f.PropertyType == typeof(DateTime))
|
||||
{
|
||||
dr[f.Name] = (DateTime)f.GetValue(AspNetRoles, null);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dr[f.Name] = f.GetValue(AspNetRoles, null);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { string s = ex.Message; }
|
||||
});
|
||||
dbh.dsdaten.Tables[0].Rows.Add(dr);
|
||||
dbh.Update_Tabeldata();
|
||||
}
|
||||
|
||||
// PUT api/<AspNetRolesController>/5
|
||||
[HttpPut("{id}")]
|
||||
public void Put(int id, [FromBody] AspNetRoles AspNetRoles)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabeldata_for_Update("Select top 1 * from [AspNetRoles] where id=" + id.ToString(), false, true);
|
||||
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
|
||||
AspNetRoles.GetType().GetProperties().ToList().ForEach(f =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (f.PropertyType == typeof(DateTime))
|
||||
{
|
||||
dr[f.Name] = (DateTime)f.GetValue(AspNetRoles, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
dr[f.Name] = f.GetValue(AspNetRoles, null);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { string s = ex.Message; }
|
||||
});
|
||||
dbh.Update_Tabeldata();
|
||||
|
||||
}
|
||||
|
||||
// DELETE api/<AspNetRolesController>/5
|
||||
[HttpDelete("{id}")]
|
||||
public void Delete(int id)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabeldata_for_Update("Select top 1 * from [AspNetRoles] where id=" + id, false, true);
|
||||
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
|
||||
dr["Aktiv"] = false;
|
||||
dr["mutiert_am"] = DateTime.Now;
|
||||
dbh.Update_Tabeldata();
|
||||
}
|
||||
}
|
||||
}
|
||||
106
CoreWebAPI1/Controllers/AspNetUserRoles.cs
Normal file
106
CoreWebAPI1/Controllers/AspNetUserRoles.cs
Normal file
@@ -0,0 +1,106 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using CoreWebAPI1.Models;
|
||||
using BWPMModels;
|
||||
using System.Data;
|
||||
using SecuringWebApiUsingApiKey.Attributes;
|
||||
|
||||
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
|
||||
namespace CoreWebAPI1.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
|
||||
public class AspNetUserRolesController : ControllerBase
|
||||
{
|
||||
// GET: api/<AspNetUserRolesController>
|
||||
[HttpGet]
|
||||
public List<AspNetUserRoles> Get()
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
//dbh.Get_Tabledata("Select * from [AspNetUserRoles]", false, true);
|
||||
|
||||
List<BWPMModels.AspNetUserRoles> Details = new List<BWPMModels.AspNetUserRoles>();
|
||||
return dbh.ConvertDataTable<BWPMModels.AspNetUserRoles>(dbh.Get_Tabledata("Select * from [AspNetUserRoles]", false, true));
|
||||
}
|
||||
|
||||
|
||||
// GET api/<AspNetUserRolesController>/5
|
||||
[HttpGet("{id}")]
|
||||
public List<AspNetUserRoles> Get(int id)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
List<AspNetUserRoles> Details = new List<AspNetUserRoles>();
|
||||
return dbh.ConvertDataTable<AspNetUserRoles>(dbh.Get_Tabledata("Select * from [AspNetUserRoles] where id=" + id.ToString(), false, true));
|
||||
}
|
||||
|
||||
// POST api/<AspNetUserRolesController>
|
||||
[HttpPost]
|
||||
public void Post([FromBody] AspNetUserRoles AspNetUserRoles)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabeldata_for_Update("Select top 1 * from [AspNetUserRoles] where id=-1", false, true);
|
||||
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
|
||||
AspNetUserRoles.GetType().GetProperties().ToList().ForEach(f =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (f.PropertyType == typeof(DateTime))
|
||||
{
|
||||
dr[f.Name] = (DateTime)f.GetValue(AspNetUserRoles, null);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dr[f.Name] = f.GetValue(AspNetUserRoles, null);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { string s = ex.Message; }
|
||||
});
|
||||
dbh.dsdaten.Tables[0].Rows.Add(dr);
|
||||
dbh.Update_Tabeldata();
|
||||
}
|
||||
|
||||
// PUT api/<AspNetUserRolesController>/5
|
||||
[HttpPut("{id}")]
|
||||
public void Put(string id, [FromBody] AspNetUserRoles AspNetUserRoles)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabeldata_for_Update("Select top 1 * from [AspNetUserRoles] where UserID='" + id.ToString()+"'", false, true);
|
||||
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
|
||||
AspNetUserRoles.GetType().GetProperties().ToList().ForEach(f =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (f.PropertyType == typeof(DateTime))
|
||||
{
|
||||
dr[f.Name] = (DateTime)f.GetValue(AspNetUserRoles, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
dr[f.Name] = f.GetValue(AspNetUserRoles, null);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { string s = ex.Message; }
|
||||
});
|
||||
dbh.Update_Tabeldata();
|
||||
|
||||
}
|
||||
|
||||
// DELETE api/<AspNetUserRolesController>/5
|
||||
[HttpDelete("{id}")]
|
||||
public void Delete(int id)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabeldata_for_Update("Select top 1 * from [AspNetUserRoles] where id=" + id, false, true);
|
||||
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
|
||||
dr["Aktiv"] = false;
|
||||
dr["mutiert_am"] = DateTime.Now;
|
||||
dbh.Update_Tabeldata();
|
||||
}
|
||||
}
|
||||
}
|
||||
125
CoreWebAPI1/Controllers/AspNetUserRolleController.cs
Normal file
125
CoreWebAPI1/Controllers/AspNetUserRolleController.cs
Normal file
@@ -0,0 +1,125 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using CoreWebAPI1.Models;
|
||||
using BWPMModels;
|
||||
using System.Data;
|
||||
using SecuringWebApiUsingApiKey.Attributes;
|
||||
|
||||
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
|
||||
namespace CoreWebAPI1.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
|
||||
public class AspNetUserRolleController : ControllerBase
|
||||
{
|
||||
// GET: api/<AspNetUserRolleController>
|
||||
[HttpGet]
|
||||
|
||||
public List<AspNetUserRolle> Get()
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
//dbh.Get_Tabledata("Select * from [AspNetUserRolle]", false, true);
|
||||
|
||||
List<BWPMModels.AspNetUserRolle> Details = new List<BWPMModels.AspNetUserRolle>();
|
||||
return dbh.ConvertDataTable<BWPMModels.AspNetUserRolle>(dbh.Get_Tabledata("Select * from [AspNetUserRolle]", false, true));
|
||||
}
|
||||
[HttpGet]
|
||||
[Route("usersql/{sql}")]
|
||||
public List<AspNetUserRolle> GetLast(string sql)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
List<BWPMModels.AspNetUserRolle> Details = new List<BWPMModels.AspNetUserRolle>();
|
||||
return dbh.ConvertDataTable<BWPMModels.AspNetUserRolle>(dbh.Get_Tabledata(sql, false, true));
|
||||
}
|
||||
|
||||
// GET api/<AspNetUserRolleController>/5
|
||||
[HttpGet("{id}")]
|
||||
public List<AspNetUserRolle> Get(int id)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
List<AspNetUserRolle> Details = new List<AspNetUserRolle>();
|
||||
return dbh.ConvertDataTable<AspNetUserRolle>(dbh.Get_Tabledata("Select * from [AspNetUserRolle] where id=" + id.ToString(), false, true));
|
||||
}
|
||||
|
||||
// POST api/<AspNetUserRolleController>
|
||||
[HttpPost]
|
||||
public void Post([FromBody] AspNetUserRolle AspNetUserRolle)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabeldata_for_Update("Select top 1 * from [AspNetUserRolle] where id=-1", false, true);
|
||||
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
|
||||
AspNetUserRolle.GetType().GetProperties().ToList().ForEach(f =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (f.PropertyType == typeof(DateTime))
|
||||
{
|
||||
dr[f.Name] = (DateTime)f.GetValue(AspNetUserRolle, null);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dr[f.Name] = f.GetValue(AspNetUserRolle, null);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { string s = ex.Message; }
|
||||
});
|
||||
dbh.dsdaten.Tables[0].Rows.Add(dr);
|
||||
dbh.Update_Tabeldata();
|
||||
}
|
||||
|
||||
// PUT api/<AspNetUserRolleController>/5
|
||||
[HttpPut("{id}")]
|
||||
public void Put(int id, [FromBody] AspNetUserRolle AspNetUserRolle)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabeldata_for_Update("Select top 1 * from [AspNetUserRolle] where id=" + id.ToString(), false, true);
|
||||
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
|
||||
AspNetUserRolle.GetType().GetProperties().ToList().ForEach(f =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (f.PropertyType == typeof(DateTime))
|
||||
{
|
||||
dr[f.Name] = (DateTime)f.GetValue(AspNetUserRolle, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
dr[f.Name] = f.GetValue(AspNetUserRolle, null);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { string s = ex.Message; }
|
||||
});
|
||||
dbh.Update_Tabeldata();
|
||||
|
||||
}
|
||||
// PUT api/<AspNetUserRolleController>/5
|
||||
[HttpPut]
|
||||
[Route("changepassword/{userid}")]
|
||||
public void Put(string userid, [FromBody] AspNetUsers Aspnetuser)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabeldata_for_Update("Select top 1 * from [AspNetUsers] where id='" + userid+"'", false, true);
|
||||
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
|
||||
dr["PasswordHash"] = Aspnetuser.PasswordHash;
|
||||
dbh.Update_Tabeldata();
|
||||
|
||||
}
|
||||
// DELETE api/<AspNetUserRolleController>/5
|
||||
[HttpDelete("{id}")]
|
||||
public void Delete(int id)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabeldata_for_Update("Select top 1 * from [AspNetUserRolle] where id=" + id, false, true);
|
||||
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
|
||||
dr["Aktiv"] = false;
|
||||
dr["mutiert_am"] = DateTime.Now;
|
||||
dbh.Update_Tabeldata();
|
||||
}
|
||||
}
|
||||
}
|
||||
114
CoreWebAPI1/Controllers/AspNetUsers.cs
Normal file
114
CoreWebAPI1/Controllers/AspNetUsers.cs
Normal file
@@ -0,0 +1,114 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using CoreWebAPI1.Models;
|
||||
using BWPMModels;
|
||||
using System.Data;
|
||||
using SecuringWebApiUsingApiKey.Attributes;
|
||||
|
||||
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
|
||||
namespace CoreWebAPI1.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
|
||||
public class AspNetUsersController : ControllerBase
|
||||
{
|
||||
// GET: api/<AspNetUsersController>
|
||||
[HttpGet]
|
||||
|
||||
public List<AspNetUsers> Get()
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
//dbh.Get_Tabledata("Select * from [AspNetUsers]", false, true);
|
||||
|
||||
List<BWPMModels.AspNetUsers> Details = new List<BWPMModels.AspNetUsers>();
|
||||
return dbh.ConvertDataTable<BWPMModels.AspNetUsers>(dbh.Get_Tabledata("Select * from [AspNetUsers]", false, true));
|
||||
}
|
||||
[HttpGet]
|
||||
[Route("usersql/{sql}")]
|
||||
public List<AspNetUsers> GetLast(string sql)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
List<BWPMModels.AspNetUsers> Details = new List<BWPMModels.AspNetUsers>();
|
||||
return dbh.ConvertDataTable<BWPMModels.AspNetUsers>(dbh.Get_Tabledata(sql, false, true));
|
||||
}
|
||||
|
||||
// GET api/<AspNetUsersController>/5
|
||||
[HttpGet("{id}")]
|
||||
public List<AspNetUsers> Get(int id)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
List<AspNetUsers> Details = new List<AspNetUsers>();
|
||||
return dbh.ConvertDataTable<AspNetUsers>(dbh.Get_Tabledata("Select * from [AspNetUsers] where id=" + id.ToString(), false, true));
|
||||
}
|
||||
|
||||
// POST api/<AspNetUsersController>
|
||||
[HttpPost]
|
||||
public void Post([FromBody] AspNetUsers AspNetUsers)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabeldata_for_Update("Select top 1 * from [AspNetUsers] where id=-1", false, true);
|
||||
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
|
||||
AspNetUsers.GetType().GetProperties().ToList().ForEach(f =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (f.PropertyType == typeof(DateTime))
|
||||
{
|
||||
dr[f.Name] = (DateTime)f.GetValue(AspNetUsers, null);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dr[f.Name] = f.GetValue(AspNetUsers, null);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { string s = ex.Message; }
|
||||
});
|
||||
dbh.dsdaten.Tables[0].Rows.Add(dr);
|
||||
dbh.Update_Tabeldata();
|
||||
}
|
||||
|
||||
// PUT api/<AspNetUsersController>/5
|
||||
[HttpPut("{id}")]
|
||||
public void Put(int id, [FromBody] AspNetUsers AspNetUsers)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabeldata_for_Update("Select top 1 * from [AspNetUsers] where id=" + id.ToString(), false, true);
|
||||
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
|
||||
AspNetUsers.GetType().GetProperties().ToList().ForEach(f =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (f.PropertyType == typeof(DateTime))
|
||||
{
|
||||
dr[f.Name] = (DateTime)f.GetValue(AspNetUsers, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
dr[f.Name] = f.GetValue(AspNetUsers, null);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { string s = ex.Message; }
|
||||
});
|
||||
dbh.Update_Tabeldata();
|
||||
|
||||
}
|
||||
|
||||
// DELETE api/<AspNetUsersController>/5
|
||||
[HttpDelete("{id}")]
|
||||
public void Delete(int id)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabeldata_for_Update("Select top 1 * from [AspNetUsers] where id=" + id, false, true);
|
||||
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
|
||||
dr["Aktiv"] = false;
|
||||
dr["mutiert_am"] = DateTime.Now;
|
||||
dbh.Update_Tabeldata();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,4 +111,4 @@ namespace CoreWebAPI1.Controllers
|
||||
dbh.Update_Tabeldata();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,6 @@ namespace CoreWebAPI1.Controllers
|
||||
}
|
||||
catch (Exception ex) { string s = ex.Message; }
|
||||
});
|
||||
dr["mutiert_am"] = DateTime.Now;
|
||||
dbh.Update_Tabeldata();
|
||||
|
||||
}
|
||||
@@ -104,4 +103,4 @@ namespace CoreWebAPI1.Controllers
|
||||
dbh.Update_Tabeldata();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
114
CoreWebAPI1/Controllers/Zeiten.cs
Normal file
114
CoreWebAPI1/Controllers/Zeiten.cs
Normal file
@@ -0,0 +1,114 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using CoreWebAPI1.Models;
|
||||
using BWPMModels;
|
||||
using System.Data;
|
||||
using SecuringWebApiUsingApiKey.Attributes;
|
||||
|
||||
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
|
||||
namespace CoreWebAPI1.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
|
||||
public class ZeitenController : ControllerBase
|
||||
{
|
||||
// GET: api/<ZeitenController>
|
||||
[HttpGet]
|
||||
|
||||
public List<Zeiten> Get()
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
//dbh.Get_Tabledata("Select * from [Zeiten]", false, true);
|
||||
|
||||
List<BWPMModels.Zeiten> Details = new List<BWPMModels.Zeiten>();
|
||||
return dbh.ConvertDataTable<BWPMModels.Zeiten>(dbh.Get_Tabledata("Select * from [Zeiten]", false, true));
|
||||
}
|
||||
[HttpGet]
|
||||
[Route("usersql/{sql}")]
|
||||
public List<Zeiten> GetLast(string sql)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
List<BWPMModels.Zeiten> Details = new List<BWPMModels.Zeiten>();
|
||||
return dbh.ConvertDataTable<BWPMModels.Zeiten>(dbh.Get_Tabledata(sql, false, true));
|
||||
}
|
||||
|
||||
// GET api/<ZeitenController>/5
|
||||
[HttpGet("{id}")]
|
||||
public List<Zeiten> Get(int id)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
List<Zeiten> Details = new List<Zeiten>();
|
||||
return dbh.ConvertDataTable<Zeiten>(dbh.Get_Tabledata("Select * from [Zeiten] where id=" + id.ToString(), false, true));
|
||||
}
|
||||
|
||||
// POST api/<ZeitenController>
|
||||
[HttpPost]
|
||||
public void Post([FromBody] Zeiten Zeiten)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Zeiten] where id=-1", false, true);
|
||||
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
|
||||
Zeiten.GetType().GetProperties().ToList().ForEach(f =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (f.PropertyType == typeof(DateTime))
|
||||
{
|
||||
dr[f.Name] = (DateTime)f.GetValue(Zeiten, null);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dr[f.Name] = f.GetValue(Zeiten, null);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { string s = ex.Message; }
|
||||
});
|
||||
dbh.dsdaten.Tables[0].Rows.Add(dr);
|
||||
dbh.Update_Tabeldata();
|
||||
}
|
||||
|
||||
// PUT api/<ZeitenController>/5
|
||||
[HttpPut("{id}")]
|
||||
public void Put(int id, [FromBody] Zeiten Zeiten)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Zeiten] where id=" + id.ToString(), false, true);
|
||||
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
|
||||
Zeiten.GetType().GetProperties().ToList().ForEach(f =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (f.PropertyType == typeof(DateTime))
|
||||
{
|
||||
dr[f.Name] = (DateTime)f.GetValue(Zeiten, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
dr[f.Name] = f.GetValue(Zeiten, null);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { string s = ex.Message; }
|
||||
});
|
||||
dbh.Update_Tabeldata();
|
||||
|
||||
}
|
||||
|
||||
// DELETE api/<ZeitenController>/5
|
||||
[HttpDelete("{id}")]
|
||||
public void Delete(int id)
|
||||
{
|
||||
dbhelper dbh = new dbhelper();
|
||||
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Zeiten] where id=" + id, false, true);
|
||||
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
|
||||
dr["Aktiv"] = false;
|
||||
dr["mutiert_am"] = DateTime.Now;
|
||||
dbh.Update_Tabeldata();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user