Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

We have a SQL Server 2012 Enterprise edition and an ASP.NET Web API 2.2 web serv

ID: 652365 • Letter: W

Question

We have a SQL Server 2012 Enterprise edition and an ASP.NET Web API 2.2 web service. The web API is the public interface for the database.

We need to end a production order doing:

Changing a value in Production orders table.

Generate a XML with all data related to this Production order.

Save that XML file into server's file system.

I have thought to do it with a POST to Web API, but I don't know if I have to do the three previous steps ( Changing value, generating XML and saving it) in a Stored Procedure or maybe in the Web API Controller.

Maybe, if I do it with the API controller, it will take a long time and the client will time out.

Explanation / Answer

Your three steps belong in the Model, not the Controller.

If it's a long-running operation, make it an asynchronous one. See Using Asynchronous Methods in ASP.NET MVC 4 and C#5, ASP.NET MVC 4, and asynchronous Web applications for more information.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote