에있는 사용자 (계정)와 개체 목록을 연결하는 방법 내 응용 프로그램의 모든 사용자에 대해 개체 목록을 저장하고 싶습니다.ASP.NET MVC
List
을 Meeting
개 개체마다 추가하고 싶습니다. 물론 내가 엔티티 프레임 워크와 함께이 일을하고 싶습니다
public class Meeting{
int Id {get;set;}
Person Person {get;set;}//Meeting with person
DateTime DateTime{get;set;}
}
질문 : 내가 그쪽으로 AccountModels.cs
이를 추가해야합니까? 이 파일에이 파일을 어디에 추가해야합니까? 모임이나 이드 만 있으면 될까요? 아니면 둘 사이에 연관성이 필요한가?
아래의 AccountModels.cs
파일의 내용을 게시하고 있습니다.
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Globalization;
using System.Web.Security;
namespace OdeToFood.Models
{
public class RegisterExternalLoginModel
{
[Required]
[Display(Name = "User name")]
public string UserName { get; set; }
public string ExternalLoginData { get; set; }
}
public class LocalPasswordModel
{
[Required]
[DataType(DataType.Password)]
[Display(Name = "Current password")]
public string OldPassword { get; set; }
[Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "New password")]
public string NewPassword { get; set; }
[DataType(DataType.Password)]
[Display(Name = "Confirm new password")]
[Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
public string ConfirmPassword { get; set; }
}
public class LoginModel
{
[Required]
[Display(Name = "User name")]
public string UserName { get; set; }
[Required]
[DataType(DataType.Password)]
[Display(Name = "Password")]
public string Password { get; set; }
[Display(Name = "Remember me?")]
public bool RememberMe { get; set; }
}
public class RegisterModel
{
[Required]
[Display(Name = "User name")]
public string UserName { get; set; }
[Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} 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; }
}
public class ExternalLogin
{
public string Provider { get; set; }
public string ProviderDisplayName { get; set; }
public string ProviderUserId { get; set; }
}
}
당신이 작성한 모든 것을 읽었습니다. 감사합니다. 그러나 뭔가를 놓쳤을 수 있습니다. 나는'클래스 회의 '를 사용자와 연관시키는 방법에 대한 정보를 찾을 수 없었다. 나는'Restaurant'''''''과 같은 클래스를 어떻게 연관시키는 지 알지만, Users는 여기서 다르게 다루어지는 것 같습니다. – Yoda
나는 내 답변을 올린 후 실제로 그 사실을 알게되었으므로 나는 그것에 대해 실제로 앞서있었습니다. 위의 업데이트를 참조하십시오. –