0
votes

HAVING TROUBLE GETTING MY EVENTS CONTROLLER TO SHOW IN BROWSER. I AM RECEIVING ERROR MESSAGE THAT MY COLUMN NAME IS INVALID

SqlException: Invalid column name 'City'. Invalid column name 'State'.

EVENT MODEL code public class Events { [Key] public int EventsId { get; set; }

    [Required(ErrorMessage = "Title is requied")]
    [StringLength(50, ErrorMessage = "Title cannot be more than 50 characters")]
    public string EventTitle { get; set; }

    [StringLength(150, ErrorMessage = "Description should not exceed 150 characters")]
    public string EventDescription { get; set; }

    [Required]
    public DateTime EventStartTime { get; set; }

    [Required(ErrorMessage = "Start Date cannot be in the past")]
    [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0;MMdd/yyyy}")]
    public DateTime EventStartDate { get; set; }
    [Required]
    public DateTime EventEndTime { get; set; }

    [Required(ErrorMessage = "End date cannot be less than Start date")]
    [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0;MMdd/yyyy}")]
    public DateTime EventEndDate { get; set; }

    public string City { get; set; }
    public string State { get; set; }
    public string EventType { get; set; }

    [Required]
    public string OrganizerName { get; set; }
    public string OrganizerContactInfo { get; set; }
    [Required(ErrorMessage = " Max tickets cannot be 0")]

    public int MaxTickets { get; set; }

    [Required(ErrorMessage = "Avaliable tickets cannot be 0")]
    public int AvaliableTickets { get; set; }

    public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
    {
        throw new NotImplementedException();
    }
}

} here

enter image description here

1

1 Answers

0
votes

There is a lot of information missing. My guess would be the Events table in your database does not contain City or State columns.