public ActionResult Edit(int id) { EditModel editModel = new EditModel(); List <int> values = new List <int>(); Property propertyItems = propertyBL.Update(id); Dictionary <int, int> PropertyValues = propertyBL.EditPropertyValues(id); foreach (KeyValuePair <int, int> item in PropertyValues) { values.Add(PropertyValues[item.Key]); } editModel.FeatureValues = values; editModel.PropertyFeatures = propertyBL.EditPropertyFeatures(propertyItems.PropertyTypeID); IEnumerable <PropertyType> propertyTypes = propertyBL.GetPropertyType(); ViewBag.propertyId = new SelectList(propertyTypes, "PropertyTypeID", "Type"); editModel.PropertyModel = AutoMapper.Mapper.Map <Property, PropertyModel>(propertyItems); return(View(editModel)); }