public ResponseBase <List <TypesContract> > GetDepartments(long countryId) { var response = new ResponseBase <List <TypesContract> >(); var list = new List <TypesContract>(); try { using (var context = new EF_DataBaseEntities()) { var result = context.USP_GET_DEPARTMENT(countryId); foreach (var item in result) { var customer = new TypesContract() { Id = item.DepartmentId, Description = item.Description }; list.Add(customer); } response.Code = StatusCode.Ok; response.Data = list; } } catch (Exception ex) { response.Code = StatusCode.InternalError; response.Message = ex.Message; } return(response); }