2013-11-25 55 views
0

我與我的HR數據庫有類似的問題。MVC 4將應用程序用戶配置文件與聯繫人表記錄進行匹配

我正在使用Google ID登錄 - UserProfile表爲應用程序用戶和Contact表存儲所有員工。

因爲用戶也可以訪問他們的記錄(更新他們的個人詳細信息)並且會提交假期請求,所以我需要將UserProfile.UserProfileID與Contact.ContactID進行匹配。

登錄 - 當創建一個新的UserProfileID並且新建聯繫人(由HR部門)創建時也應該如此。

有什麼建議嗎?

貝婁是UserProfile和Contact的模型。 用戶配置

public class UserProfileViewModel 
{ 
    [Key] 
    public int ID { get; set; } 
    [Display(Name = "User Name")] 
    public string UserName { get; set; } 
    [Display(Name = "First Name")] 
    public string FirstName { get; set; } 
    [Display(Name = "Last Name")] 
    public string LastName { get; set; } 
    [DisplayFormat(NullDisplayText = "", DataFormatString = "{0:dd/MM/yyyy hh:mm tt}")] 
    public DateTime? LastLogon { get; set; } 
    [Display(Name = "Roles")] 
    public string[] UserRoles { get; set; } 
    public string DisplayName { get; set; } 
} 

聯繫

public class Contact 
{ 
    public int ID { get; set; } 
    public int? TitleID { get; set; } 
    public string FirstName { get; set; } 
    public string LastName { get; set; } 
    public DateTime? DOB { get; set; } 
    public int? GenderID { get; set; } 
    public int? CategoryID { get; set; } 
    public int? SiteID { get; set; } 

.... }

謝謝

回答

1

設法找到一種方法來解決這個問題。 通過添加一個名爲ContactID的新字段修改UserProfile表,然後在創建新聯繫人時創建UserProfile,並將Contact.ID傳遞給UserProfile.ContactID。

相關問題