小编Bri*_*ian的帖子

ASP.NET MVC 核心级联 DropDownList

我无法找到展示如何使用 EntityFramework 从数据库实现级联 DropDownList 的教程/视频。我正在使用 ASP.NET MVC Core、EntityFramework Core 和 C#。

到目前为止,我可以将数据库中的数据检索到我的 3 DropDownList 中。

我希望能够完成的是让用户首先选择一个州,然后显示与该州相关的所有城市。然后在用户选择一个城市后,它将显示与该城市相关的邮政编码。

任何帮助将不胜感激。

楷模

    public class Customer
{
    public int CustomerId { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }

    public int StateId { get; set; }
    public int CityId { get; set; }
    public int ZipId { get; set; }

    public State State { get; set; }
    public City City { get; set; }
    public Zip …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework-core asp.net-core-mvc

6
推荐指数
1
解决办法
2万
查看次数

ASP.NET Core MVC 加密/解密 QueryString 值

我正在使用 ASP.NET Core 2.0 MVC、C#、Entity Framework Core Code First 和 SQL Server 2016。

我创建了一个 Web 表单,我所有的 CRUD 操作都运行良好。但是,我需要一些关于加密/解密传递给确认、编辑和删除视图的查询字符串值的帮助。

在我的“索引”页面上,当用户将鼠标悬停在指向这些操作方法的“编辑”和“删除”链接上时,我还想对 EmployeeID 进行加密。我不希望它们在索引页上可见。

请参阅我下面的代码。

楷模

public class Employee
{
    public int EmployeeID { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }

    public int DepartmentID { get; set; }
    public Department Department { get; set; }

    public int AppointmentID { get; set; }
    public Appointment Appointment { get; set; }
}

public class Department …
Run Code Online (Sandbox Code Playgroud)

c# encryption asp.net-core-mvc asp.net-core-2.0 asp.net-core-mvc-2.0

1
推荐指数
1
解决办法
1万
查看次数