Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL-ServerMVCRazor
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.
 

 
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 30-Aug-12 3:05am
Edited 30-Aug-12 3:40am
v2
Comments
Karthik. A at 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 at 30-Aug-12 12:59pm
   
thanks its all done..
Sergey Alexandrovich Kryukov at 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

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Shai Vashdi 963
1 Tadit Dash 270
2 Sergey Alexandrovich Kryukov 250
3 OriginalGriff 233
4 Peter Leow 180
0 Sergey Alexandrovich Kryukov 9,435
1 OriginalGriff 5,498
2 Peter Leow 4,230
3 Maciej Los 3,540
4 Abhinav S 3,353


Advertise | Privacy | Mobile
Web04 | 2.8.140415.2 | Last Updated 30 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid