Update 20210528 - mit LoginPopup

This commit is contained in:
2021-05-28 16:20:53 +02:00
parent 5dcd0d1046
commit a437ae0be4
172 changed files with 16125 additions and 103 deletions

View File

@@ -15,47 +15,46 @@ namespace CoreWebAPI1.Controllers
[Route("api/[controller]")]
[ApiController]
public class MenuController : ControllerBase
public class MenuItemController : ControllerBase
{
// GET: api/<MenuController>
[HttpGet]
public List<Menu> Get()
public List<MenuItem> Get()
{
dbhelper dbh = new dbhelper();
//dbh.Get_Tabledata("Select * from [Menu]", false, true);
List<Menu> Details = new List<Menu>();
return dbh.ConvertDataTable<Menu>(dbh.Get_Tabledata("Select * from [Menu]", false, true));
dbh.Get_Tabledata("Select * from [MenuItem]", false, true);
return dbh.ConvertDataTable<MenuItem>(dbh.Get_Tabledata("Select * from [Menu]", false, true));
}
// GET api/<MenuController>/5
[HttpGet("{id}")]
public List<Menu> Get(int id)
public List<MenuItem> Get(int id)
{
dbhelper dbh = new dbhelper();
List<Menu> Details = new List<Menu>();
return dbh.ConvertDataTable<Menu>(dbh.Get_Tabledata("Select * from [Menu] where id=" + id.ToString(), false, true));
List<MenuItem> Details = new List<MenuItem>();
return dbh.ConvertDataTable<MenuItem>(dbh.Get_Tabledata("Select * from menuitem where aktiv=1 and ( menutype=100 or menutype=1 or menutype = " + id.ToString() + ") order by menutype, sort",false,true));
}
// POST api/<MenuController>
[HttpPost]
public void Post([FromBody] Menu Menu)
public void Post([FromBody] MenuItem MenuItem)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Menu] where id=-1", false, true);
dbh.Get_Tabeldata_for_Update("Select top 1 * from [MenuItem] where id=-1", false, true);
DataRow dr = dbh.dsdaten.Tables[0].NewRow();
Menu.GetType().GetProperties().ToList().ForEach(f =>
MenuItem.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Menu, null);
dr[f.Name] = (DateTime)f.GetValue(MenuItem, null);
}
else
{
dr[f.Name] = f.GetValue(Menu, null);
dr[f.Name] = f.GetValue(MenuItem, null);
}
}
catch (Exception ex) { string s = ex.Message; }
@@ -66,22 +65,22 @@ namespace CoreWebAPI1.Controllers
// PUT api/<MenuController>/5
[HttpPut("{id}")]
public void Put(int id, [FromBody] Menu Menu)
public void Put(int id, [FromBody] MenuItem MenuItem)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Menu] where id=" + id.ToString(), false, true);
dbh.Get_Tabeldata_for_Update("Select top 1 * from [MenuItem] where id=" + id.ToString(), false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
Menu.GetType().GetProperties().ToList().ForEach(f =>
MenuItem.GetType().GetProperties().ToList().ForEach(f =>
{
try
{
if (f.PropertyType == typeof(DateTime))
{
dr[f.Name] = (DateTime)f.GetValue(Menu, null);
dr[f.Name] = (DateTime)f.GetValue(MenuItem, null);
}
else
{
dr[f.Name] = f.GetValue(Menu, null);
dr[f.Name] = f.GetValue(MenuItem, null);
}
}
catch (Exception ex) { string s = ex.Message; }
@@ -95,7 +94,7 @@ namespace CoreWebAPI1.Controllers
public void Delete(int id)
{
dbhelper dbh = new dbhelper();
dbh.Get_Tabeldata_for_Update("Select top 1 * from [Menu] where id=" + id, false, true);
dbh.Get_Tabeldata_for_Update("Select top 1 * from [MenuItem] where id=" + id, false, true);
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
dr["Aktiv"] = false;
dr["mutiert_am"] = DateTime.Now;

View File

@@ -36,7 +36,14 @@ namespace CoreWebAPI1.Controllers
List<User> Details = new List<User>();
return dbh.ConvertDataTable<User>(dbh.Get_Tabledata("Select * from [user] where id=" + id.ToString(), false, true));
}
[HttpGet("{username},{passwort}")]
public List<User> Get(string username, string passwort)
{
dbhelper dbh = new dbhelper();
List<User> Details = new List<User>();
return dbh.ConvertDataTable<User>(dbh.Get_Tabledata("Select * from [user] where aktiv=1 and username='"+username+"' and passwort='"+passwort+"'", false, true));
}
// POST api/<UserController>
[HttpPost]
public void Post([FromBody] User user)