public static IEnumerable <IContactMechStateDto> ToContactMechStateDtoCollection(IEnumerable <string> ids) { var states = new List <IContactMechStateDto>(); foreach (var id in ids) { var dto = new ContactMechStateDtoWrapper(); dto.ContactMechId = id; states.Add(dto); } return(states); }
public IContactMechStateDto Get(string id, string fields = null) { try { var idObj = id; var state = _contactMechApplicationService.Get(idObj); if (state == null) { return(null); } var stateDto = new ContactMechStateDtoWrapper(state); if (String.IsNullOrWhiteSpace(fields)) { stateDto.AllFieldsReturned = true; } else { stateDto.ReturnedFieldsString = fields; } return(stateDto); } catch (Exception ex) { var response = ContactMechesControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }