[Solved] ASP.Net MVC Error: the type or Namespace Name customer could not be found

akhter
 
on Nov 10, 2021 08:43 PM
524 Views

Followed link

Select Insert Edit Update and Delete (CRUD) using Single Stored Procedure in ASP.Net MVC

Error: the type or Namespace Name customer could not be found

below is index code

@model IEnumerable<Customer>
@{ 
    Layout = null;
    WebGrid webGrid = new WebGrid(source: Model, canPage: true, canSort: false);
}
<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>
        INDEX
    </title>
</head>
<body>
</body>
</html>

Controller

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebApplication7.Models;

namespace WebApplication7.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            // GET: Home
            using (SchoolEntities1 entities1 = new SchoolEntities1())
            {
                List<Customer1> customers1 = entities1.Customer_PerformanceCRUD("Select", null, null, null).ToList();
                customers1.Insert(0, new Customer1());
                return View(customers1.ToList());
            }
        }
    }
}

 

Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
on Nov 10, 2021 08:48 PM
akhter says:
@model IEnumerable<Customer>

Replace with below.

@model IEnumerable<Customer1>

 

arjunv
 
on Nov 11, 2021 11:27 PM
on Nov 11, 2021 11:29 PM

Hi Akhter,  

Please refer below Article for how to configure Entity Framework.

ASP.Net MVC: Simple Entity Framework Tutorial with example