Click here to Skip to main content
15,891,902 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
hi..

i m beginer in mvc 3

i have set up database for application on server.
all is working well...except

when i m creating a new record this gets error.

@model Surveys.SurveysServiceReference.Survey

@{
    ViewBag.Title = "Create";
}



It shows error on SurveysServiceReference that service reference cannot found.

I have foloowing model for cretaing it.



XML
using System;
using System.Runtime.Serialization;
using System.Collections.Generic;

namespace SurveysService.Models
{
    [DataContract(IsReference = true)]
    public class Survey
    {
        public Survey()
        {
            this.Topics = new List<Topic>();
        }
        [DataMember]
        public int SurveyID { get; set; }
        [DataMember]
        public string Title { get; set; }
        [DataMember]
        public string CreatedBy { get; set; }
        [DataMember]
        public Nullable<System.DateTime> Date { get; set; }
        [DataMember]
        public virtual ICollection<Topic> Topics { get; set; }
    }
}


plz give me direction to create a record in database.

thanks
Posted
Updated 30-Aug-12 3:40am
v2
Comments
Karthik. A 30-Aug-12 9:42am    
Changing @model Surveys.SurveysServiceReference.Survey to @model SurveysService.Models.Survey should take care of that issue. You just have an incorrect namespace in your view.
Ritesh Rana 30-Aug-12 12:59pm    
thanks its all done..
Sergey Alexandrovich Kryukov 18-Mar-13 10:12am    
Please stop posting non-answers as "solution". It can give you abuse reports which eventually may lead to cancellation of your CodeProject membership. And the fact you even self-accepted on formally is just outrageous, a sure way for a ban. I hope you won't do it after this warning.

Comment on any posts, reply to available comments, or use "Improve question" (above).
Also, keep in mind that members only get notifications on the post sent in reply to there posts.
—SA

1 solution

Apart from the answer you were given, you should create viewmodels for your views, these encapsulate one or more model objects and other data that is specific to the view being created.
 
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