✅ Kinda new to MVC/C#/Razor - Need some help passing data from Model -> Controller

As the title states, I'm kinda new to C#/MVC with a good bit of experience with software development. I just need a bit of help getting this implemented :)
9 Replies
JakenVeina
JakenVeina9mo ago
$details
MODiX
MODiX9mo ago
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, and what you expect the result to be. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
Left On The Moon
gotcha, sorry, also new to the server haha so as of right now, I have a very simple mvc application, with a controller hitting a public web API - for context, it's a security API that allows you to throw in the hash of a password into the api to scan a db of exposed passwords to determine if the password's been involved in a data breach (we're building a little security website for our capstone) - with this, I need to take the input from the user in the razor front end and pass it into the method as a parameter to be used in the api call for me, this is a very simple process i'd be able to do in Python/Java/JS/even C#, my core issue lies with struggling to understand the MVC framework or not necessarily not understanding it, but getting it to all work together - every guide I see online typically has MVC bound to a db of some sort, but we just need to make lil api calls in the front end
JakenVeina
JakenVeina9mo ago
data is passed from client to server in an MVC app through form submissions which usually means a POST so, you add a POST handler method to your controller, with a data model to match the form state that will be submitted
JakenVeina
JakenVeina9mo ago
if you're not interested in having a database in the backend, then don't the mechanisms for communication between the frontend and the controller don't change
Left On The Moon
I actually ended up figuring it out using this?
No description
Left On The Moon
i'm calling more controller, and then method I wasn't sure if using MVC was a good call in this application use case - designed to be very minimal with a nice bootstrapped frontend with a bit of controllers in place mvc's cool bc it helps in getting an application off the ground pretty quick, but once again, I'm not overly used to using it and this may not have been the best call
Accord
Accord9mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts