mvc pass user id to table from FormsAuthentication
<p>the problem is when i try to created item give me this error </p>

<p>The INSERT statement conflicted with the FOREIGN KEY constraint</p>

<p>here's my login action</p>

<pre><code> public ActionResult Login(UserTb U, string ReturnUrl)
    {
        var count = db.UsersTb.Where(x =&gt; x.NameUser == U.NameUser &amp;&amp; x.PassUser == U.PassUser).Count();
        if (count == 0)
        {
            ViewBag.Msg = "invalde user";
            return View();
        }
        else
        {
            FormsAuthentication.SetAuthCookie(U.NameUser + "|" + U.IdUser, false);
            return RedirectToAction("Index", "Home");

        }

    }
</code></pre>

<p>and i want pass user id to table named items </p>

<p>and user id on this table named Uid so i used this below </p>

<pre><code>[Table("Item")]
public class Item
{
    [Key]
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public int id { get; set; }
    [Required]
    public string name { get; set; }
    public string info { get; set; }
    public decimal price { get; set; }

    public int? Uid { get; set; }
    public int CatId { get; set; }

    public int? CountryId { get; set; }

    public int? StateId { get; set; }

    public int? CityId { get; set; }

    [ForeignKey("Uid")]
    public virtual UserTb UserTb { get; set; }

    [ForeignKey("CatId")]
    public virtual Category Category { get; set; }

    [ForeignKey("CountryId")]
    public virtual Country Country { get; set; }

    [ForeignKey("StateId")]
    public virtual States States { get; set; }

    [ForeignKey("CityId")]
    public virtual City City { get; set; }

    public Item()
    {
        Uid = Convert.ToInt32(HttpContext.Current.User.Identity.Name.Split('|')[1]);
    }

}
</code></pre>

<p>and here my create action result </p>

<pre><code>public ActionResult Create()
    {
        var catlist = db.Categories.Select(x =&gt; new { id = x.id, name = x.name }).ToList();
        SelectList sl = new SelectList(catlist.AsEnumerable(), "id", "name");
        ViewBag.SelectCategories = sl;

        var countrylist = db.CountryTb.Select(x =&gt; new { id = x.id, name = x.name }).ToList();
        SelectList s2 = new SelectList(countrylist.AsEnumerable(), "id", "name");
        ViewBag.SelectCountry = s2;

        return View();

    }

    [HttpPost]
    public ActionResult Create(Item i)
    {
        db.Items.Add(i);
        db.SaveChanges();
        return RedirectToAction("Index");

    }
</code></pre>

<p>if another way to save user id when login and get it when i need it on other table without problem please tell me how because i'm newbie in mvc</p>