public void Method(PaperDTO objpaper) { ModelState.Remove("ListState"); List <StateDTO> liststate = new List <StateDTO>(); liststate = new List <StateDTO>() { new StateDTO { StateId = 0, StateName = "Select" } }; foreach (var item in objState.GetStates()) { StateDTO sm = new StateDTO(); sm.StateId = item.StateId; sm.StateName = item.StateName; liststate.Add(sm); } objpaper.ListState = liststate; }
public ActionResult Create() { CityDTO objCM = new CityDTO(); List <StateDTO> liststate = new List <StateDTO>(); liststate = new List <StateDTO>() { new StateDTO { StateId = 0, StateName = "Select" } }; foreach (var item in objState.GetStates()) { StateDTO st = new StateDTO(); st.StateId = item.StateId; st.StateName = item.StateName; liststate.Add(st); } objCM.ListState = liststate; return(View(objCM)); }
[NonAction] // if Method is not Action method then use NonAction public List <StateDTO> BindListState() { List <StateDTO> liststate = new List <StateDTO>() { new StateDTO { StateId = 0, StateName = "Select" } }; foreach (var item in objStateMaster.GetStates()) { StateDTO st = new StateDTO(); st.StateId = item.StateId; st.StateName = item.StateName; liststate.Add(st); } return(liststate); }
public ActionResult Details() { return(View(objIStateMaster.GetStates())); }
public IEnumerable <StateDTO> StateList() { return(objStateM.GetStates()); }