private void AddRows() { dataGridViewPosts.Rows.Clear(); foreach (var post in _qt.GetDirectoryPosts().ToList()) { DataGridViewRow row = new DataGridViewRow(); row.CreateCells(dataGridViewPosts); row.Cells[0].Value = post.Id; row.Cells[1].Value = post.Name; row.Cells[2].Value = post.DirectoryTypeOfPost.Name; row.Cells[3].Value = post.DirectoryCompany.Name; row.Cells[4].Value = post.Date.ToShortDateString(); row.Cells[5].Value = post.UserWorkerSalary; row.Cells[6].Value = post.UserHalfWorkerSalary; dataGridViewPosts.Rows.Add(row); } }