TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ar Vhin
NA
498
90k
MVC: How to display only Active customer
Jul 29 2018 11:06 PM
How to display only Active customer(isActive : true) in mvc.
Reply
Answers (
3
)
1
Rajesh Gami
81
24.4k
1.3m
Jul 29 2018 11:12 PM
try this
in model
public
class
CustomerMaster
{
//- your field
}
public
class
CustomerMasterContext : DbContext
{
public
CustomerMasterContext() :
base
(
"Connectionstring_Name"
)
{ }
public
DbSet<CustomerMaster> CustomerMaster {
get
;
set
; }
}
now Controller
public
class
AdminCustomerController : Controller
{
CustomerMasterContext _customerContext =
new
CustomerMasterContext();
public
ActionResult Index()
{
var active = _customerContext.CustomerMaster.Where(b=>b.CSMIsActive==
true
).ToList();
return
View(active);
}
}
now add view and show output.
Accepted Answer
1
Jenith Thakkar
349
5k
27.9k
Jul 29 2018 11:11 PM
For that you can use Linq Queries
Like This
var CustomerList=db.Customers.where(l=>l.IsActive==true).toList();
And in VIewSIde Get this Customer List
If you still facing any issue then provide your code i will tell you the solution
0
Ar Vhin
0
498
90k
Jul 29 2018 11:23 PM
thank u both of u guys rajesh and jenith
What is base class library ?
Implementing drag and drop