This question is locked. New answers and comments are not allowed.
Is there a better way to fill a DTO from a domain model entity, or am i doing it correctly? Here is a example:
public IList<StateDTO> getStates(){ IList<StateDTO> stateslist = new List<StateDTO>(); try { using (MyDBContext dbContext = new MyDBContext()) { IList<States> states = dbContext.States.ToList(); foreach (States state in states) { stateslist.Add(new StateDTO(state.StateCode, state.StateName)); } } } catch (Exception ex) { //TODO: ADD ERROR LOGGING AND HANDLING } return stateslist;}