Solved

Convert C# solution to a function that can be called by MVC

Posted on 2015-02-01
2
181 Views
Last Modified: 2015-02-01
I have a c# console solution. The solution runs and generates a report in the form of a datatable.
I use a around 10 different classes and 1 dll within the solution.

I would like to convert the solution to a funtion that can be called by ASP.NET MVC with a parameter and return the content of the datatable. Is this possible? If so, how can I do it?
0
Comment
Question by:esak2000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 250 total points
ID: 40582741
Well, it's .NET, so you could potentially just add a reference to the console application from your MVC application, and then use it the same way you would a DLL. If you really want to, you could convert it to a library.
0
 
LVL 36

Assisted Solution

by:Miguel Oz
Miguel Oz earned 250 total points
ID: 40582845
Two alternatives:
A1. Call your console app from MVC using Process.Start. check the sample method LaunchCommandLineApp for further details.
Notice that your web site (thus your console app) runs under a restricted user account, make sure you have the appropriate security permissions.
A2. Refactor the classes/dll of the console app into a library, then in that library implement a public static method that can be called by both your console app and your MVC project. In other words you are sharing the common logic between the 2 apps. the advantage is you do not have to worry about security permissions.
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Run software updates from the website 6 51
Why am I losing my session variable value 11 40
CSS styling problem 3 28
VB .net 2010 Byte array 2 24
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question