0

I'm not even sure how to search for this question, so forgive me if I'm asking a duplicate question and would be grateful for any redirection needed.

I have data (Account Number, Password, Internal Y/N) that is being submitted to an Account Table from Navision. I want to use this data to automatically create a user in the UserProfile table (Username = Account Number, Password = Password) and assign that user to the Admin role if Internal = Y and DealerAdmin if Internal = N.

The data will continue to be maintained for Account numbers in Navision, but the DealerAdmin can add additional users from the website. Is this possible? If so, please provide any pointers to tutorials as to where to start? I presume it's a simple SQL statement. Where do I add this code in MVC so that it gets updated every time there's new data in the Account Table?

Josh McGee
  • 75
  • 8

1 Answers1

0

If you are using SQL why not use a trigger to create a new record in your User UserProfile when your conditions are met?

If this does not work for you can take a look at the post below and call your proc to move the data over if needed.

ASP.NET MVC 4 intercept all incoming requests

Community
  • 1
  • 1
Nanuz
  • 76
  • 1
  • 3
  • I just looked up triggers and I think a trigger would work and is what I want. Where do I store it in mvc? Is this action? Sorry, I'm still pretty new to sql and asp.net. – Josh McGee Dec 20 '16 at 03:36
  • Lookup how to add trigger to sql table. – Nanuz Dec 20 '16 at 13:32
  • Sorry for the late reply. I had to shelve this project for a while. I will be picking it back up in the next few weeks. It's looking like this is the solution I'm looking for though. As soon as I finish the sql and it works I'll mark this as answered. – Josh McGee Jan 17 '17 at 03:09
  • I was able to finish the programming for this today. I created two triggers (one for when a record is inserted into the Customer table and one for when it's updated. Thank you for your help. – Josh McGee Jan 23 '17 at 17:00