Update 20210528 - mit LoginPopup
This commit is contained in:
@@ -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;
|
||||
@@ -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)
|
||||
|
||||
48
CoreWebAPI1/Models/ForgotPasswordInputModel.cs
Normal file
48
CoreWebAPI1/Models/ForgotPasswordInputModel.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BWPMService.Models
|
||||
{
|
||||
public class ForgotPasswordInputModel
|
||||
{
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
public string Email { get; set; }
|
||||
}
|
||||
|
||||
public class LoginInputModel
|
||||
{
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
public string Email { get; set; }
|
||||
|
||||
[Required]
|
||||
[DataType(DataType.Password)]
|
||||
public string Password { get; set; }
|
||||
|
||||
[Display(Name = "Remember me?")]
|
||||
public bool RememberMe { get; set; }
|
||||
}
|
||||
|
||||
public class RegisterInputModel
|
||||
{
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
[Display(Name = "Email")]
|
||||
public string Email { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "Password")]
|
||||
public string Password { get; set; }
|
||||
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "Confirm password")]
|
||||
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
|
||||
public string ConfirmPassword { get; set; }
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
||||
b56ab60ae855c23d8d0d3ca5cdd33a74ac11bf8d
|
||||
a632bd66ebc5418931eba0b0184c5b7240b1c900
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user