Click here to Skip to main content
15,883,773 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MVC1.Models;
namespace MVC1.Controllers
{
    public class customer
    {
        public string customername { get; set; }
        public string address { get; set; }
        public string phone { get; set; }
        public override string ToString()
        {
            return this.customername + "" + this.address + this.phone;
        }  
    }
    public  class employee
    {
        public string Firstname { get; set; }
        public string LastName { get; set; }
        public int budget { get; set; }
    }
    
    public class TestController : Controller
    {
        public ActionResult GetView()
        {
            employee emp = new employee();
            emp.Firstname = "KARAN";
            emp.LastName = "Kumar";
            emp.budget = 30000;
            ViewData["employee"] = emp;
            return View("View");
        }
        public customer Getcustomer()
        {
            customer cus = new customer();
            cus.customername = "AMAN";
            cus.address = "   From Srilanka ";
            cus.phone = " 456478546";
            return cus;
        }
	}
}


What I have tried:

i tried searching for System.Configuration in the .net assemblies references also but this reference is also available

Getting error in this portion of code Model
using MVC1.Models;
Posted
Updated 12-Jan-21 14:04pm
Comments
Afzaal Ahmad Zeeshan 17-Jul-17 9:04am    
What is the complete error message can you tell that?
David_Wimbley 17-Jul-17 9:10am    
You need to post your full error message. You mention System.Configuration as if its complaining about that DLL not being referenced yet your talking about your MVC1.Models namespace so it isn't clear what your issue is without a full error message.
Member 11644373 18-Jul-17 2:57am    
The type namespace name 'Modles' doesn't exist in the namespace 'MVC1'(are you missing an assembly reference?)

1 solution

Probably because you don't have a reference set to the project/.DLL that contains that namespace

OR the projects are targeting two different, and reference incompatible, versions of the .NET Framework.

OR the projects are built using differing Target Platforms, x64 or AnyCPU on one and x86 on the other.
 
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