lundi 2 mai 2016

Filtering the records in c# from view

I am having a view which is like

CREATE view [dbo].[vw_myList]

as

SELECT tblOrg.locationName Name, 

       tblOrg.locationID Id,

       from tables with some joins.

as you can see I am not having any accepting paramameter for this view but now I have one condition on some another web page that will be using this view but it needs to filter the selected records from this view using locationId

like where locationId = @argument

I have tried to use it like below:

       var locationList = this._Service.GetlocationLists();

List<mymodel> objlist = new List<mymodel> objlist

// This gets all records

  var list= locationList .Select(m => new mymodel
            {
                 name = Name, id= Id
            });

but i wanted to use it like but it is not working

  var list= locationList.where(m=>m.id==@argument).Select(m => new mymodel
            {
                 name = Name, id= Id
            });

Aucun commentaire:

Enregistrer un commentaire