public async Task <T> EditItem(T inboundItem) { var editItem = await _entities.FirstOrDefaultAsync <T>(x => x.ID == inboundItem.ID); var editedObject = ToDoMapper <T> .MapChanges(inboundItem, editItem); await _context.SaveChangesAsync(); return(editedObject); }
private void RefreshData() { var todos = new ToDoMapper().GetAll(); var bindingList = new BindingList <ToDo>(todos); dataGridViewToDo.AutoGenerateColumns = false; dataGridViewToDo.Rows.Clear(); foreach (var item in bindingList) { var rowIndex = dataGridViewToDo.Rows.Add(); var row = dataGridViewToDo.Rows[rowIndex]; row.Cells["Title"].Value = item.Title; row.Cells["TextOfItem"].Value = item.Text; } }