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
on controller actione of ItemcontrollerCode:var result = await _context.ReferenceFiles.Where(r => r.TableName == "Employees").ToListAsync(); ViewBag.RefList = result;
on viewCode:var result = await _context.ReferenceFiles.Where(r => r.TableName == "Items").ToListAsync(); ViewBag.RefList = result;
Table Reference have 3 fieldsCode:@foreach (var itemes in ViewBag.RefList) { <thead> @itemes.FieldName </thead> }
code
FieldName
TableName




Reply With Quote
