public IActionResult GetItemTypes() { List <ItemType> itemTypes = repo.GetItemTypes(); if (itemTypes != null) { List <ItemTypeDto> itemTypesDto = new List <ItemTypeDto>(); foreach (ItemType i in itemTypes) { itemTypesDto.Add( new ItemTypeDto { Type = i.Type }); } return(StatusCode(200, response.AllItemTypeResponse(itemTypesDto))); } else { Response errorResponse = new Response { StatusText = "A server error has occured.", StatusCode = 500, Status = false, }; return(StatusCode(500, errorResponse)); } }