- // Index.cshtml
- @{
- ViewBag.Title = "EventManagement List";
- }
EventManagement List
"EventManagementTable" class="display">
- @*Semantic UI*@
- @*
"employeeTable" class="ui celled table">*@
- @*Bootstrap*@
- @*
"employeeTable" class="table table-striped table-bordered">*@
TrainingID TrainingType TrainingDescription Price Venue Facilitator WhoAttend RSVP TrainingID TrainingType TrainingDescription Price Venue Facilitator WhoAttend RSVP - "stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/dt-1.10.20/datatables.min.css" />
- "//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" rel="stylesheet" />
- "https://cdn.datatables.net/1.10.15/css/dataTables.jqueryui.min.css" rel="stylesheet" />
- "//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.6/semantic.min.css" rel="stylesheet" />
- "https://cdn.datatables.net/1.10.15/css/dataTables.semanticui.min.css" rel="stylesheet" />
- "https://cdn.datatables.net/1.10.15/css/dataTables.bootstrap4.min.css" rel="stylesheet" />
- @section scripts{
- "//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0.0-alpha.6/css/bootstrap.css" rel="stylesheet"/>
- }
Hi TeamI want to find a way to access my members of model class to my Controller class, when using ApplicationDbContext. The database is attached to my App_Data and has table to it, and want to find a way to access those fields in my Controller class using ApplicationDbContext, can anyone help me if there is a way. Below is my logic so far and screen shot showing what i am aiming to achieve.
- //Controller class
- using System.Web;
- using System.Web.Mvc;
- using ContentManagementSystem.Filters;
- using ContentManagementSystem.Models;
- using Microsoft.AspNet.Identity.EntityFramework;
- namespace ContentManagementSystem.Controllers
- {
- public class DashboardController : Controller
- {
- public ActionResult _Index()
- {
- return View();
- }
- public ActionResult GetList()
- {
- using(ApplicationDbContext db = new ApplicationDbContext())
- {
- var emptList = db.Users.
- return Json(new { data = emp })
- }
- }
- }
- }
- // Model class
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using Microsoft.AspNet.Identity.EntityFramework;
- namespace ContentManagementSystem.Models
- {
- public class ApplicationUser:IdentityUser
- {
- public string Email { get; set; }
- public bool ConfirmedEmail { get; set; }
- }
- public class ApplicationDbContext: IdentityDbContext
- {
- public ApplicationDbContext()
- : base("eNtsaOnlineRegistrationDB")
- {
- }
- }
- }
16 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Loading
Guest UserPosted Feb 11, 2020, 4:36 AM
Guest UserPosted Feb 11, 2020, 3:17 AM
Ashutosh GuptaPosted Feb 11, 2020, 3:05 AM
Guest UserPosted Feb 11, 2020, 2:32 AM
Guest UserPosted Feb 11, 2020, 12:49 AM
Ashutosh GuptaPosted Feb 11, 2020, 12:12 AM
Guest UserPosted Feb 10, 2020, 11:28 PM
Ashutosh GuptaPosted Feb 10, 2020, 10:02 PM
Guest UserPosted Feb 10, 2020, 7:09 AM
Ashutosh GuptaPosted Feb 10, 2020, 6:58 AM
Guest UserPosted Feb 10, 2020, 6:53 AM
Ashutosh GuptaPosted Feb 10, 2020, 6:35 AM
Guest UserPosted Feb 10, 2020, 6:18 AM
Ashutosh GuptaPosted Feb 10, 2020, 6:05 AM
Guest UserPosted Feb 10, 2020, 5:51 AM
Ashutosh GuptaPosted Feb 10, 2020, 5:00 AM