public ActionResult Add(listing addListing) { try { //Check Authentication if (Session["user"] == null) { return(RedirectToAction("Index", "Login")); } //Object Initiliaze ListingModel model = new ListingModel(); Agents agent = new Agents(); Buildings building = new Buildings(); Features feature = new Features(); //Start performing the logic section model.AgentList = agent.GetAgents().Select(t => new ListingAgentControl() { Name = t.firstname + " " + t.lastname, Id = t.id, IsCheck = false }).ToList(); model.BuildingList = building.GetBuildings().Select(t => new SelectListItem { Text = t.Name, Value = t.id.ToString() }).ToList(); model.BuildingFeaturesList = feature.GetFeatures().Select(t => new BuildingFeaturesControl() { features_name = t.features_name, id = t.id, IsCheck = false }).ToList(); model.OpenHouseList.Add(new OpenHouse()); return(View(model)); } catch (Exception ex) { //handling exception throw ex; } }