Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have a codings in controller as shown below....

public ActionResult SearchItem()
{
return View(_objItemService.BuildSearchItemView());
}

[HttpPost]
public ActionResult SearchItem(ItemViewModel objtext)
{
if (///_objItemService.BuildSearchItem(objtext)///)
{
return View("SearchItem");
}
return View(_objItemService.BuildSearchItemView());
}

And i created a list in servicelayer like this coding shown below:

public IList<itemviewmodel> BuildSearchItem(ItemViewModel text)
{
IList<itemviewmodel> lkitem = new List<itemviewmodel>();
foreach (var item in _objItemRep.GetItem())
{
lkitem.Add(new ItemViewModel() { ItemId = item.ItemId, ItemTitle = item.ItemTitle, ItemDesc = item.ItemDesc });
}
return lkitem;
}

I got error in controller actionresult searchlinkeditem in the line of if condition that i mentioned within three forward slash....
(///objitemservice.Buildsearchitem(objtext)///)

The above coding shows the error like Cannot implicity convert type system.Collections.generic.Ilist to bool......How to solve it

Cany anyone give me a solution....
Posted
Comments
Sergey Alexandrovich Kryukov 21-Dec-12 0:33am    
What is "above" coding? What line exactly? Even if I could figure out, why? And please use "pre" tags around code.
—SA

1 solution

Hi,
I have a codings in controller as shown below....
public ActionResult SearchItem()
{
return View(_objItemService.BuildSearchItemView());
}
 
[HttpPost]
public ActionResult SearchItem(ItemViewModel objtext)
{
if (///_objItemService.BuildSearchItem(objtext)///)
{
return View("SearchItem");
}
return View(_objItemService.BuildSearchItemView());
}


And i created a list in servicelayer like this coding shown below:
public IList BuildSearchItem(ItemViewModel text)
{
IList lkitem = new List();
foreach (var item in _objItemRep.GetItem())
{
lkitem.Add(new ItemViewModel() { ItemId = item.ItemId, ItemTitle = item.ItemTitle, ItemDesc = item.ItemDesc });
}
return lkitem;
}

I got error in controller actionresult searchlinkeditem in the line of if condition that i mentioned within three forward slash....
(///objitemservice.Buildsearchitem(objtext)///)


The above coding shows the error like Cannot implicity convert type system.Collections.generic.Ilist to bool......How to solve it

Cany anyone give me a solution....
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900