namespace ResidentCertificate.Models { public class Users_ { public Int32 UserID { get; set; } public string userName { get; set; } public Int32 userAccessID { get; set; } public Int32 organizational_positionID { get; set; } public string loginTime { get; set; } public string logofTime { get; set; } public string computerName { get; set; } public string computerIP { get; set; } }
using ResidentCertificate.Interfaces; using ResidentCertificate.Models; namespace ResidentCertificate.DataAccess { public class Users_DataAccessLayer : IUsers_ { public string connectionString = globalsetting.connectionstring; public IEnumerable<users_> GetAllUsers_() { try { List<users_> lstusers_ = new List<users_>(); using (SqlConnection con = new SqlConnection(connectionString)) { SqlCommand cmd = new SqlCommand("spGetAllUsers_", con); cmd.CommandType = CommandType.StoredProcedure; con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { Users_ users_ = new Users_(); users_.UserID = Convert.ToInt32(rdr["UserID"]); users_.userName=rdr["userName"].ToString(); users_.userAccessID = Convert.ToInt32(rdr["userAccessID"]); users_.organizational_positionID = Convert.ToInt32(rdr["organizational_positionID"]); users_.loginTime=rdr["loginTime"].ToString(); users_.logofTime=rdr["logofTime"].ToString(); users_.computerName=rdr["computerName"].ToString(); users_.computerIP=rdr["computerIP"].ToString(); lstusers_.Add(users_); } con.Close(); } return lstusers_; } catch { throw; } }
using ResidentCertificate.Models; using ResidentCertificate.Interfaces; using ResidentCertificate.DataAccess; namespace ResidentCertificate.Controllers { public class KartablController : Controller { // GET: KartablController DataAccess.Users_DataAccessLayer userslist = new Users_DataAccessLayer(); public ActionResult Index() { IEnumerable<models.users_> Model = userslist.GetAllUsers_(); return View(); }
@model IEnumerable<residentcertificate.models.users_> ...
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)