how to convert Laravel 5.1/PHP website into ASP.NET - asp.net-mvc

I have a complete working Website in Laravel 5.1 and want to Migrate the entire code into ASP.NET MVC 5.x. Is there any easy way to do this? Thanks

Simple answer NO.
Long answer:
Learn ASP.net if you don't already know it
Code the website according to what you need
Note: There is no copy-paste solution, if that's what your looking for. I don't think anyone will create something to 'translate' a laravel (php) to asp.net
There are options to help you along the way:
1.Migrating from PHP to ASP.NET
2.Migration assistants
3.Online conversion
As you can see there are helpers, but I wouldn't rely on them. As you might already know mvc works with different folders, controllers, models, views etc. The conversion tools won't exactly know how to deal with them, so you will have to edit them afterwards, which might take you more time to get a grip on how and what was converted in stead of just coding it all over.
So to "convert" a laravel website it would at least require that you convert all files in your laravel project folder. Just thinking about it, I wouldn't want to go that route.

Related

HTML5 input types and the asp.net MVC Framework

Im looking to make the editor templates in my MVC application use HTML5 input types. The framework seems to get about 80% of the way there but there are a couple of things I can't seem to make happen (step values on numerics, placeholders, URL inputs, etc).
I'm sure that quite a bit of this is just me not knowing where to look, but
Is there a definitive list of what attributes I can use on View Models to provide the metadata used to generate the html?
Does anyone know of a project / nuget package that helps with this? I'm not opposed to writing something, but would rather use something that's already been tried and tested. Dean Hume's ASP.net MVC HTML5 Helpers Toolkit is close, but I'd like to put as much information in the attributes as possible and let the runtime do the work via Html.EditorFor (just a personal preference).
Thanks,
Joe
Check this out : http://weblogs.asp.net/rashid/archive/2010/10/21/integrate-html5-form-in-asp-net-mvc.aspx
See if it can help you get started.

WordPress template for Orchard

I am looking for a charity template to help my friend to make a website for a non-profit organization.
But I don't know how to program in PHP, I already know ASP.Net MVC 3 and C#.
I found out a nice template: http://osc4.template-help.com/wordpress_30418/
but is just for wordpress, does anybody know if is possible to adapt it to use with ASP.Net MVC, or Orchard?
Best regards,
Tito
It would require a lot of work. You should be able to strip away the php and fill in the appropriate Orchard code. Your first goal could be to do remove the PHP. Then mock in the HTML to get it to look right then change it to use Razor. The top is flash.

Should I use .erb or .rhtml files for a Rails app in which all Controller logic exists in Views?

I'm just starting to learn Rails. I created an empty Rails app. And instead of writing a Controller, I want to put all of my Controller logic in my Views instead of in separate Controller classes.
To do this, should I use .erb files or .rhtml files and what's the difference?
First of all, they are virtually the same thing but you should use the new standard naming format of .html.erb
Second of all, stop what you are doing and reconsider everything!!!!!
The whole point of MVC is to separate logic from display and vice versa. Most of your logic should be in your models and the controller should just facilitate grabbing that logic and passing it to your views.
You should not do anything in your views other than display the data.
"A client has asked me to build and install a custom shelving system. I'm at the point where I need to nail it, but I'm not sure what to use to pound the nails in.
Should I use an old shoe or a glass bottle?
In your case I'd go for the glass bottle.
In the new rails 3.0 .rhtml files will be unsupported. .html.erb is the new standard.
I understand that you have a small app and standards don't really apply to you, but that is the whole point of MVC. The logic should go into the controller/model and the view is strictly for presentation.
The simple answer to your question is no. No you shouldn't put controller logic in the views. If you don't need controllers then you probably don't need rails. I know that's not the answer you want, but frankly you are wrong, pure and simple. If you want to learn the Rails framework, then what you have been told here is correct and to do it your way would simply then mean either unlearning what you just did or it would mean becoming a bad developer.
That's the way it is, the rest is now up to you.
Yes, you are correct in that the creators of rails never stated that you should not use rails for smaller apps, but they have stated over and over the importance of the controller.
I created an empty Rails app. And instead of writing a Controller, I want to put all of my Controller logic in my Views instead of in separate Controller classes.
Just out of curiosity, what type of logic are you considering putting into your views? If it is presentation logic then that is one thing but if it is business rules, loading data from a database, xml file, web service/rest based then you are violating the core principles of rails. Ever heard of ASP (Classic Active Server Pages)? Frameworks have evolved beyond that to overcome the shortcomings and pitfalls like ASP to allow you not to mix presentation and code. If you jam it all together, how will you unit test your code? Another key principle of rails that is why it is built into the framework itself unlike other web frameworks.
I want to learn how to use the "standard" Ruby framework
In your responses you keep mentioning you want to learn the standard Ruby framework? If this is the case why don't you use irb then? Rails is not part of the standard Ruby framework. In fact you will probably learn a lot more about Ruby using irb then you will Rails. Once you have familiarized yourself with Ruby then take on rails.
I agree with the others and if you are going to take the time to learn a framework, then learn it right and as the creator intended, otherwise you are missing the point and you will not see why rails is such a good web framework to begin with. What you are hoping to accomplish can be done in a number of web technologies: ASP, ASP.Net, PHP, JSP, Perl, but you choose to learn Ruby and rails therefore do not do it the same as you could in any of the other web technologies.
Adhering to MVC is the way to proceed to build an application.
If you are uncertain why Controller is needed then do the research. I have
faced maintaining code where the scrips are embedded in the presentation layer.
It is farcical to begin any engineering effort without a thorough understanding
of the correct, time tested methodology. It is like trying to build a house
using no foundation or blueprint.
Nothing, really. It’s just a change of philosophy between Rails 1 and Rails 2. Before Rails 2, you had file.rhtml, file.rxml and file.rjs. In Rails, that changed to file.content_type.template_engine. So with file.html.erb, the content type is html and the template engine is ERb. rxml is now xml.builder and rjs should now (mostly) be js.rjs
In the new rails 3.0 .rhtml files will be unsupported. .html.erb is the new standard.

WebForms to MVC conversion

I've got a pretty simple site (around 8 pages) with only one way page containing any significant codebehind, and I'd like to try learning MVC, using it as the test.
Is it best to start a new MVC Web App from scratch and cut-and-paste the HTML in, or will it be easier to retool the existing files.
Basically, what am I in for? What's it gonna take to get my Web Forms app into the MVC model? What approach should I take? Create the default MVC web app and start cutting-and-pasting? Add the appropriate namespaces and learn to setup the MVC structure myself?
Unlike tvanfosson, I think you will actually learn more about MVC by trying to translate your existing application. You'll learn which assemblies to add, you'll work out how to associate the right http handlers, you'll learn what the correct web.config settings are, and you'll know which dependencies to remove from your web application to get it to work.
To be honest, it will feel harder doing it this way and be a little more frustrating, but at the end of the process you will know a hell of a lot more than just starting a new one from scratch. Good luck with it.
You'll want to start from a project template in a new project. Transfer your markup to your new views as needed, although it's more likely that you'll just be using the old site as a design template than actually reusing code. You'll find that MVC is much different than WebForms.
I don't think retooling the existing Web Forms application is the best approach (or even feasible). As you will surely discover, the differences between Web Forms and MVC are quite big. So, starting from scratch (although you can recycle the html) will most likely be the better approach and the best way to learn as much as possible about MVC.

Migrating web application to asp.net mvc

I need your advice regarding migration. I want to migrate existing project to ASP.NET MVC and I can figure out the proccess except of url rewriting issue:
for example how can I make following route:
http://www.eireads.com/ireland/mayo/cars-3/1263-used-cars-citroen-c5-for-sale.aspx
Or maybe I could somehow keep supporting legacy routes.
I think that migrating a web forms applicaiton to MVC is going to be very hard unless you have a clear seperation of concerns in your current applicaiton. If you have followed a design pattern like MVP then it might be easier, but if not then much of your business logic is likey going to have to be moved to controller classes and much of it re-written.
I would start by extracting your model, this should be fairly easy, then identifying your controllers and actions and seeing how much code you can re-use. At this point you should be able to discern whether or not you can migrate or if you'll be better off re-writing portions of your applicaiton.
Default URL patterns in ASP.NET MVC are http(s)://(appdomain)/(controller)/(action)/(par/ame/ters)
So your url above should fit into that pattern. You can change the pattern to account for other things (like namespace for example). Your URL pattern might be:
http://www.eireads.com/cars/used/ireland/mayo/citreon
where ireland, mayo and citreon are the in put parameters.
I think you should really re-write your question and try to detail exactly what you are attempting to accomplish here.
If you are asking how to migrate an existing WebForm project into ASP.NET MVC keeping the same URL rewrite, the answer is; not easily. The models are too different.
Yet, you mention "routes" in the end, which make me think you are speaking like those of the System.Web.Routing namespace. So are you dealing with an existing MVC app and want it too look like that URL path? I can't tell. I am confused.

Resources