1 Replies - 275 Views - Last Post: 30 December 2018 - 08:46 AM

#1 ahmedba   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 181
  • Joined: 24-January 14

how to use repeated get data from table from one place by using genera

Posted 29 December 2018 - 05: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


Is This A Good Question/Topic? 0
  • +

Replies To: how to use repeated get data from table from one place by using genera

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15062
  • View blog
  • Posts: 60,147
  • Joined: 12-June 08

Re: how to use repeated get data from table from one place by using genera

Posted 30 December 2018 - 08:46 AM

I am not following, what?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1