You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
121 lines
4.4 KiB
121 lines
4.4 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using BWPMModels;
|
|
using BlazorApp.Helper;
|
|
using Newtonsoft.Json;
|
|
using System.Data;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace BlazorApp.Controller
|
|
|
|
{
|
|
|
|
public class AspNetUsersController : ControllerBase
|
|
{
|
|
public static List<AspNetUsers> GetAllData()
|
|
{
|
|
dbhelper dbh = new dbhelper();
|
|
dbh.Get_Tabledata("Select * from AspNetUsers", false, true);
|
|
return dbh.ConvertDataTable<AspNetUsers>(dbh.dsdaten.Tables[0]);
|
|
}
|
|
|
|
public static List<AspNetUsers> GetByID(int ID)
|
|
{
|
|
dbhelper dbh = new dbhelper();
|
|
dbh.Get_Tabledata("Select * from AspNetUsers where id=" + ID.ToString(), false, true);
|
|
return dbh.ConvertDataTable<AspNetUsers>(dbh.dsdaten.Tables[0]);
|
|
}
|
|
|
|
public static List<AspNetUsers> GetByUserName(string UserName)
|
|
{
|
|
dbhelper dbh = new dbhelper();
|
|
dbh.Get_Tabledata("Select * from AspNetUsers where UserName='" + UserName+"'", false, true);
|
|
return dbh.ConvertDataTable<AspNetUsers>(dbh.dsdaten.Tables[0]);
|
|
}
|
|
public static List<AspNetUsers> GetByEMail(string EMail)
|
|
{
|
|
dbhelper dbh = new dbhelper();
|
|
dbh.Get_Tabledata("Select * from AspNetUsers where EMail='" + EMail + "'", false, true);
|
|
return dbh.ConvertDataTable<AspNetUsers>(dbh.dsdaten.Tables[0]);
|
|
}
|
|
public static List<AspNetUsers> GetLast()
|
|
{
|
|
dbhelper dbh = new dbhelper();
|
|
dbh.Get_Tabledata("Select top 1 * from AspNetUsers order by mutiert_am desc", false, true);
|
|
return dbh.ConvertDataTable<AspNetUsers>(dbh.dsdaten.Tables[0]);
|
|
}
|
|
public static List<AspNetUsers> GetLastByMutierer(string Mutierer)
|
|
{
|
|
dbhelper dbh = new dbhelper();
|
|
dbh.Get_Tabledata("Select top 1 * from AspNetUsers where mutierer='" + Mutierer + "' order by mutiert_am desc", false, true);
|
|
return dbh.ConvertDataTable<AspNetUsers>(dbh.dsdaten.Tables[0]);
|
|
}
|
|
|
|
public static List<AspNetUsers> GetbyUserSQL(string SQL)
|
|
{
|
|
dbhelper dbh = new dbhelper();
|
|
dbh.Get_Tabledata(SQL, false, true);
|
|
return dbh.ConvertDataTable<AspNetUsers>(dbh.dsdaten.Tables[0]);
|
|
}
|
|
|
|
public static void POST(AspNetUsers AspNetUsersdata)
|
|
{
|
|
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();
|
|
AspNetUsersdata.GetType().GetProperties().ToList().ForEach(f =>
|
|
{
|
|
try
|
|
{
|
|
if (f.PropertyType == typeof(DateTime))
|
|
{
|
|
dr[f.Name] = (DateTime)f.GetValue(AspNetUsersdata, null);
|
|
}
|
|
else
|
|
{
|
|
dr[f.Name] = f.GetValue(AspNetUsersdata, null);
|
|
}
|
|
}
|
|
catch (Exception ex) { string s = ex.Message; }
|
|
});
|
|
|
|
dbh.dsdaten.Tables[0].Rows.Add(dr);
|
|
dbh.Update_Tabeldata();
|
|
|
|
}
|
|
|
|
public static void PUT(AspNetUsers AspNetUsersdata)
|
|
{
|
|
dbhelper dbh = new dbhelper();
|
|
dbh.Get_Tabeldata_for_Update("Select top 1 * from [AspNetUsers] where id=" + AspNetUsersdata.Id.ToString(), false, true);
|
|
DataRow dr = dbh.dsdaten.Tables[0].Rows[0];
|
|
AspNetUsersdata.GetType().GetProperties().ToList().ForEach(f =>
|
|
{
|
|
try
|
|
{
|
|
if (f.PropertyType == typeof(DateTime))
|
|
{
|
|
dr[f.Name] = (DateTime)f.GetValue(AspNetUsersdata, null);
|
|
}
|
|
else
|
|
{
|
|
dr[f.Name] = f.GetValue(AspNetUsersdata, null);
|
|
}
|
|
}
|
|
catch (Exception ex) { string s = ex.Message; }
|
|
});
|
|
dbh.Update_Tabeldata();
|
|
|
|
}
|
|
|
|
public static void DELETE(AspNetUsers AspNetUsersdata)
|
|
{
|
|
dbhelper dbh = new dbhelper();
|
|
dbh.Get_Tabeldata_for_Update("delete from [AspNetUsers] where id=" + AspNetUsersdata.Id.ToString(), false, true);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} |