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
ahmed elbarbary
NA
1.6k
275.3k
How to use repeated get data from table from one place by us
Dec 29 2018 6:48 PM
How to use repeated get data from table from one place by using general function take table name or any solution .
I get data from table reference but there different on table name selected from this table . so that i will use same get data statement on more controller so that to prevent repeated get data i think to put this on one place by general function or any concept prevent repeated but i cannot do that .
on controller actione of employeecontroller
var result = await _context.ReferenceFiles.Where(r => r.TableName ==
"Employees"
).ToListAsync();
ViewBag.RefList = result;
on controller actione of Itemcontroller
var
result = await _context.ReferenceFiles.Where(r => r.TableName ==
"Items"
).ToListAsync();
ViewBag.RefList = result;
on view
@foreach (
var
itemes
in
ViewBag.RefList)
{
<thead>
@itemes.FieldName
</thead>
}
Table Reference
have
3 fields
code
FieldName
TableName
Reply
Answers (
1
)
How to compare string array with datatable using linq in C#
How to use entity framework with table that not have primary