why part 2 is returning null.
the strange part is that if i search by string type then null returns, but if i search by integer type or bool type. then i get brand object.
Part 1
//.... OK code
public static Brand GetBrand(string name)
{
DataContext db = new DataContext();
using (db)
{
Brand b = (from v in db.Brands
where v.Name == name
select v).FirstOrDefault();
return b;
}
}
[HttpGet]
public IHttpActionResult Get(string name)
{
Brand b = MobileHandler.GetBrand(name);
return Ok(b);
}
Part 2
//..... Return null
public static List<Brand> GetBrands()
{
DataContext db = new DataContext();
using (db)
{
return db.Brands.ToList();
}
}
[HttpGet]
public IHttpActionResult Get(string name)
{
return Ok((from v in MobileHandler.GetBrands()
where v.Name == name
select v).FirstOrDefault());
}
But I get the following error:
<Brand xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/DataLayer.MobileMgt" i:nil="true"/>