Insert users Id into multiple tabels using MVC Identity

后端 未结 2 836
北恋
北恋 2020-12-12 06:29

I want to insert user id to multiple tables after registration success

public async Task Register(RegisterViewModel model , RoleViewModel         


        
2条回答
  •  旧时难觅i
    2020-12-12 06:43

    You instantiate the ApplicationDbContext context but you don't use it. You then use entities but where does that come from? With only the controller code shown here, my guess is you should do:

    context.activities.Add(activity);
    context.SaveChanges();
    

    Finally, you pass in RoleViewModel role but you don't use it. Maybe you can remove that?

提交回复
热议问题