public List <User> AllUsers() { DataTable dt = new DataTable(); dt = objbluser.GetAllUsers(); List <User> lstusrs = new List <User>(); User retobj; if (dt != null) { if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { retobj = new User(); retobj.UserId = Convert.ToInt32(dt.Rows[i]["UserId"].ToString()); retobj.FirstName = dt.Rows[i]["FirstName"].ToString(); retobj.LastName = dt.Rows[i]["LastName"].ToString(); retobj.InsertedBy = dt.Rows[i]["InsertedBy"].ToString(); retobj.InsertedOn = Convert.ToDateTime(dt.Rows[i]["InsertedOn"].ToString()); retobj.MobileNo = dt.Rows[i]["ContactNo"].ToString(); //retobj.Password = dt.Rows[i]["Password"].ToString(); retobj.UpdatedBy = dt.Rows[i]["UpdatedBy"].ToString(); retobj.UpdatedOn = Convert.ToDateTime(dt.Rows[i]["UpdatedOn"].ToString()); retobj.UserTypeId = dt.Rows[i]["UserTypeId"].ToString(); retobj.Age = Convert.ToInt32(dt.Rows[i]["Age"].ToString()); retobj.Gender = dt.Rows[i]["Gender"].ToString(); retobj.Birthdate = Convert.ToDateTime(dt.Rows[i]["BirthDate"].ToString()); retobj.EmailId = dt.Rows[i]["EmailId"].ToString(); retobj.IsActive = Convert.ToInt32(dt.Rows[i]["IsActive"].ToString()); lstusrs.Add(retobj); } } } return(lstusrs); }
public ActionResult UserList() { var blUser = new BLUser(); return(View("UserList", blUser.GetAllUsers())); }