예제 #1
0
        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);
        }
예제 #2
0
        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;
            }
        }