in Education by
I have already tried to make a login form and I also want to display the user login profile that I have stored in the database. However, I have no idea how to do it neither from the model nor the controller. I have stored all the user information in the Customers table of my database. This is the code of Customer model: public IList GetProfileCustomer(string name) { var list_customer = from c in DataContext.Customers where c.WebAccount == name select c; return list_customer.ToList(); } And this my AccountController: public ActionResult ShowProfile() { return View(); } I want to get the result that I wrote in my model, to display in my view. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Pass the result of the function as ViewModel: public ActionResult ShowProfile() { ViewData.Model = GetProfileCustomer("foo"); return View(); } Then your view will declare @model IList and you'll access properties simply like this: @foreach (var customer in Model) {

@customer.FirstName

}

Related questions

0 votes
    I have already tried to make a login form and I also want to display the user login profile that ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    I have batch of user accounts and every user account's password is not crypted.I want to insert to ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I'm using restful routing module for asp.net mvc and very happy with it. But I can't get one ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    I need to integrate IDX MLS into a real estate website. Also I want to know how to implement ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 6, 2022 in Education by JackTerrance
0 votes
    I am developing a .NET core application with Identity login which provides a Bootstrap form In the /Identity ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 23, 2022 in Education by JackTerrance
0 votes
    I have implemented exception handling as mentioned in below link How to pass error message to error view in ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I've started to work a bit with master pages for an ASP.net mvc site and I've come across a ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 27, 2022 in Education by JackTerrance
0 votes
    I've started to work a bit with master pages for an ASP.net mvc site and I've come across a ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 27, 2022 in Education by JackTerrance
0 votes
    Say I have a page that display search results. I search for stackoverflow and it returns 5000 results, 10 per page. Now I ... was posted previously etc.. What I'd like to do is...
asked Mar 23, 2022 in Education by JackTerrance
0 votes
    Has anybody established a good naming convention for action in MVC? I was specifically looking at ASP.net ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 23, 2022 in Education by JackTerrance
0 votes
    I'm looking to build an reusable control or custom helper for my MVC project. I'm sure there is ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    I'm looking to build an reusable control or custom helper for my MVC project. I'm sure there is ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    I'm looking to build an reusable control or custom helper for my MVC project. I'm sure there is ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    Say I have a page that display search results. I search for stackoverflow and it returns 5000 results, 10 per page. Now I ... was posted previously etc.. What I'd like to do is...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 10, 2022 in Education by JackTerrance
...