Advertisement
Guest User

Untitled

a guest
Mar 4th, 2015
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. return View(customerModel);
  2.  
  3. "The model item passed into the dictionary
  4. is of type 'CustomerPortal_MVC.Models.CustomerModel',
  5. but this dictionary requires a model item of type 'CustomerPortal_MVC.Customer'."
  6.  
  7. public ActionResult Details()
  8. {
  9. using (var context = new CustomerPortalEntities())
  10. {
  11. var customers = context.Search_Customer_By_Name("NONA", "WHITE", null);
  12. CustomerModel customerModel = new CustomerModel();
  13. foreach (var item in customers)
  14. {
  15. customerModel.Account_Number = item.Account_Number;
  16. customerModel.First_Name = item.First_Name;
  17. customerModel.Last_Name = item.Last_Name;
  18. customerModel.Payment_in = item.Payment_in;
  19.  
  20.  
  21. }
  22.  
  23. public class CustomerModel
  24. {
  25. public int Customer_ID { get; set; }
  26. public string Account_Number { get; set; }
  27. public string First_Name { get; set; }
  28. public string Last_Name { get; set; }
  29. public string Payment_in { get; set; }
  30.  
  31.  
  32.  
  33. }
  34.  
  35. return View(customerModel);
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement