Invalid anonymous type member declarator. Anonymous type members must be declared with a member assignment, simple name or member access.

745 views
Skip to first unread message

Priya Aptekar

unread,
Nov 8, 2014, 5:58:27 AM11/8/14
to mongodb...@googlegroups.com
public ActionResult Index()
        {
            var car = (from c in context.car.AsQueryable<Cars>()

                       select new
                       {
                           c.carmake.make =(context.carmake.AsQueryable<CarMake>().Where(p=> p.CarMakeid == c.CarMakeid).Select(p=> p.make).FirstOrDefault).ToString  
                       })
                    .Any();
            var carforsell = context.car.FindAll()  ;
            return View(carforsell);
        }

help me to solve this i want to show car make serch by _id in onther collection car
my car model
public class Cars
    {
        public Cars()
        {
            this.carphoto = new HashSet<carphotos>();
            //this.city = new HashSet<citytable>();
            
        }
        [ScaffoldColumn(false)]
        [BsonId]
        public ObjectId carid { get; set; }

        [DisplayName("Make")]
        public string CarMakeid { get; set; }

        [DisplayName("Model")]
        public string  CarModelid { get; set; }

        [DisplayName("Version")]
        public string CarVersionid { get; set; }

       
        [DisplayName("Make Year")]
        public DateTime makeyear { get; set; }
        public string Memsid { get; set; }
        [DisplayName("Kms Driven")]
        public string kmsDriven { get; set; }

        [DisplayName("Country")]
        public short countryid { get; set; }

        [Required]
        [DisplayName("State")]
        public short stateid { get; set; }

        [Required]
        [DisplayName("City")]
        public short cityid { get; set; }

        [DisplayName("Pin code")]
        public int pincode { get; set; }

        [DisplayName("Expected Price in Rs.")]
        public int expectedprice { get; set; }

        [DisplayName("Description")]
        public string sellersNote { get; set; }
        public DateTime Entrydate { get; set; }
        [BsonIgnore]
        public virtual carFeatures feature { get; set; }
        [BsonIgnore]
        public virtual CarCondition  carcondition { get; set; }
        [BsonIgnore]
        public virtual WarrantiesModifications warrentiesmodificaton { get; set; }
        [BsonIgnore]
        public virtual CarMake carmake { get; set; }
        [BsonIgnore]
        public virtual CarModel carmodel { get; set; }
        [BsonIgnore]
        public virtual CarVersion carversion { get; set; }
        [BsonIgnore]
        public  List<citytable> city = new List<citytable>() ;
        [BsonIgnore]
        public virtual states states { get; set; }
        [BsonIgnore]
        public virtual Country country { get; set; }
        [BsonIgnore]
        public virtual Mems mems { get; set; }
        [BsonIgnore]
        public virtual ICollection<carphotos> carphoto { get; set; } 
        public Cars(sellCar sc)
        {
            CarMakeid = sc.CarMakeid;
            CarModelid = sc.CarModelid;
            CarVersionid = sc.CarVersionid;
            makeyear = sc.makeyear;
            Memsid = sc.Memsid;
            kmsDriven = sc.kmsDriven;
            countryid = sc.countryid;
            stateid = sc.stateid;
            cityid = sc.cityid;
            pincode = sc.pincode;
            expectedprice = sc.expectedprice;
            sellersNote = sc.sellersNote;
            Entrydate = sc.Entrydate; 
        }
    }
my car make model
 public partial class CarMake
    {
        [BsonId]
        public ObjectId CarMakeid { get; set; }

        [Required]
        [DisplayName("Make")]
        public string make { get; set; }
    }
 
in list i want to show the name of make but its showing blank


Reply all
Reply to author
Forward
0 new messages