Hello all please can you kindly help me out , i keep getting the error
The model item passed into the dictionary is of type 'System.Data.Entity.Infrastructure.DbQuery`1[<>f__AnonymousType2`9[System.String,System.Nullable`1[System.Double],System.String,System.String,System.String,System.Nullable`1[System.DateTime],System.String,System.String,System.String]]', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1[LiberiaWaterBillingApplication.ViewModels.Building_Customer]'.
Here is my controller code
- [HttpPost]
- public ActionResult searchpin1(string searchpin, LiberiaWaterBillingApplication.Models.BILLING_TABLE billmodel)
- {
- int searchpinint = Convert.ToInt16(searchpin);
- var CustomerVMlist = (from b in db1.BUI_TAB
- join c in db1.CUS_TAB on b.CUS_ID equals c.CUS_ID
- where b.PIN_NUM == searchpinint
- select new
- {
- b.NEW_TAR,
- b.ASS_QTY,
- b.ASS_UNI,
- b.BUI_TYP,
- c.ZON_NAM_NEW,
- c.ZON_COD_NEW,
- c.WAT_CON_STA,
- c.SUR_NAM,
- c.OTH_NAM
- });
- //if (pin_details == null)
- // {
- //billmodel.= " You have not enetered a Pinnmumber";
- //}
- // else
- //{ }
- return View(CustomerVMlist.AsEnumerable());
- }
This is my view code
- @model IEnumerable
- @{
- ViewBag.Title = "Newsearch";
- Layout = "~/Views/Shared/_Layout.cshtml";
- }
Newsearch
Login - "login-div">
- @using (Html.BeginForm("searchpin1", "DataEntry", FormMethod.Post))
- {
"text-decoration:underline"> "text" name="pinsearch" /> "submit" name="submitbutton" value="Login" />"reset" name="resetbutton" value="Reset" /> - }
Thank you

Ahmed AbdiPosted Aug 17, 2019, 12:35 PM