static void Main (string [] args) { TodoItems items = new TodoItems (); TodoItems.TodoItemsDataTable table = items._TodoItems; Assert.IsNotNull (table, "#1"); Assert.AreEqual ("TodoItems", table.TableName, "#2"); }
public void Update(TodoItems item) { var todoItem = this.Find(item.ID); var index = _toDoList.IndexOf(todoItem); _toDoList.RemoveAt(index); _toDoList.Insert(index, item); }
private async Task Delete(TodoItemDto todoItem) { await TodoAppService.DeleteAsync(todoItem.Id); await Notify.Info("Deleted the todo item."); TodoItems.Remove(todoItem); }
public async Task <ActionResult <TodoItems> > PostTodoItems(TodoItems todoItems) { _context.TodoItems.Add(todoItems); await _context.SaveChangesAsync(); // return CreatedAtAction("GetTodoItems", new { id = todoItems.Id }, todoItems); return(CreatedAtAction(nameof(GetTodoItems), new { id = todoItems.Id }, todoItems)); }
private static TodoItemsDTO ItemToDto(TodoItems todoItem) { return(new TodoItemsDTO { Id = todoItem.Id, Name = todoItem.Name, IsComplete = todoItem.IsComplete }); }
private void ApplyFilter() { TodoItems.Clear(); foreach (var item in TodoItemDisplayState.Value == TodoItemState.All ? todoItems : todoItems.Where(i => i.State.Value == TodoItemDisplayState.Value)) { TodoItems.Add(item); } }
private async void OnRefreshCommandExecuted() { TodoItems.Clear(); foreach (var item in await _apiClient.GetTodoItemsAsync()) { TodoItems.Add(item); } }
public TodoContext(DbContextOptions <TodoContext> options) : base(options) { if (TodoItems.Any()) { return; } SeedDummyData(); }
public void AddTodoItemToList() { TodoItems.Add(new TodoItem() { Name = NewTodoItemName }); NewTodoItemName = string.Empty; toDoListService.Save(TodoItems); }
private void UpdateUnsyncData() { var unSyncList = TodoItems.Where(e => !e.IsSynced); foreach (var todoItem in unSyncList) { _crudTodotTable.InsertOrUpdate(todoItem); } }
public ActionResult <TodoItems> PostNew(long id, TodoItems item) { if (id != item.Id) { return(BadRequest()); } ctx.TodoItems.Remove(item); ctx.SaveChanges(); return(NoContent()); }
public IActionResult Post([FromBody] TodoItems todoItems) { if (todoItems == null || !todoItems.IsComplete || string.IsNullOrEmpty(todoItems.Name)) { return(BadRequest("Objeto está vazio.")); } _todoItemsService.Add(todoItems); return(CreatedAtRoute("Get", new { Id = todoItems.Id }, todoItems)); }
private void OnMoveToDoCommand(Card card) { if (!TodoItems.Contains(card)) { DoingItems.Remove(card); CompletedItems.Remove(card); TodoItems.Add(card); } _cardsManager.Save(TodoItems, DoingItems, CompletedItems); }
// Essa é uma das formas possíveis de obter os registros (diretamente pelo contexto) public async Task <IEnumerable <TodoItemRecord> > GetTodoItemRecords(int listId, IConfigurationProvider configurationProvider, CancellationToken cancellationToken) { var records = await TodoItems .Where(t => t.ListId == listId) .AsQueryable() .ProjectTo <TodoItemRecord>(configurationProvider) .ToListAsync(cancellationToken); return(records); }
private void OnMoveCompleteComamnd(Card card) { if (!CompletedItems.Contains(card)) { TodoItems.Remove(card); DoingItems.Remove(card); CompletedItems.Add(card); } _cardsManager.Save(TodoItems, DoingItems, CompletedItems); }
public async Task <IActionResult> Create([Bind("item_id,item_name")] TodoItems todoItems) { if (ModelState.IsValid) { _context.Add(todoItems); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(Ok(todoItems)); }
private async void AddItem(object todoItemValue) { TodoItem todoItem = todoItemValue as TodoItem; if (todoItem != null) { await repository.AddAsync(todoItem); TodoItems.Add(todoItem); } }
public async Task <ActionResult <TodoItemDto> > GetTodoItem(long id) { var todoItem = await _context !.TodoItems.FindAsync(id); if (todoItem == null) { return(NotFound()); } return(ItemToDto(todoItem)); }
public ActionResult Index() { var todoItems = new TodoItems(); todoItems.Todos = _todos; // This is just a POCO to capture the screen input todoItems.Item = new Todo(); return(View(todoItems)); }
public IActionResult Create([FromBody] TodoItem item) { if (item == null) { return(HttpBadRequest()); } TodoItems.Add(item); return(CreatedAtRoute("GetTodo", new { controller = "Todo", id = item.Key }, item)); }
public IActionResult GetById(string id) { var item = TodoItems.Find(id); if (item == null) { return(HttpNotFound()); } return(new ObjectResult(item)); }
public bool Delete(int id) { var item = TodoItems.FirstOrDefault(t => t.Id == id); if (item != null) { TodoItems.Remove(item); return(true); } return(false); }
// GET /TODO/EDIT/ public async Task <ActionResult> Edit(int id) { TodoItems item = await context.TodoItems.FindAsync(id); if (item == null) { return(NotFound()); } return(View(item)); }
public void CheckFindById_Ok() { //Arrange Todo todo1 = TodoItems.AddNewTodo("Drink a beer"); Todo todo2 = TodoItems.AddNewTodo("Find the Bear"); //Act Todo chosenOne = TodoItems.FindById(todo2.TodoId); //Assert Assert.Equal(todo2.TodoId, chosenOne.TodoId); }
public async Task <IActionResult> PutTodoItem(long id, TodoItems item) { if (id != item.Id) { return(BadRequest()); } _context.Entry(item).State = EntityState.Modified; await _context.SaveChangesAsync(); return(NoContent()); }
public TodoContext(DbContextOptions <TodoContext> options) : base(options) { if (!TodoItems.Any()) { Add(new TodoItem("Buy a new guitar", false)); Add(new TodoItem("Buy a present for Mike's birthday", false)); Add(new TodoItem("Ring Grandma", true)); } SaveChanges(); }
private void OnTodoItemRemoveRequested(object sender, EventArgs e) { if (!(sender is TodoItem removedTodoItem)) { return; } removedTodoItem.RemoveRequested -= OnTodoItemRemoveRequested; removedTodoItem.State.PropertyValueChanged -= OnTodoItemStateChanged; todoItems.Remove(removedTodoItem); TodoItems.Remove(removedTodoItem); }
private async void UpdateItem(object todoItemValue) { TodoItem todoItem = todoItemValue as TodoItem; if (todoItem != null) { await repository.UpdateAsync(todoItem); int pos = TodoItems.IndexOf(TodoItems.Where(x => x.Id == todoItem.Id).SingleOrDefault()); TodoItems.RemoveAt(pos); TodoItems.Insert(pos, todoItem); } }
private async void DeleteItem(object id) { int deletedId = Convert.ToInt32(id); TodoItem todoItem = TodoItems.SingleOrDefault(x => x.Id == deletedId); if (todoItem != null) { await repository.RemoveAsync(todoItem); TodoItems.Remove(todoItem); } }
public ActionResult AddItem(Models.Todo item) { ModelState.Clear(); var currentItems = (List <Todo>)TempData["CurrentItems"] ?? new List <Todo>(); currentItems.Add(item); TempData["CurrentItems"] = currentItems; TodoItems todoItems = HomeControllerHelper.CreateModel(currentItems); return(View("Index", todoItems)); }
public void FindAllItems_ClearedItems_EmptyArray() { //arrange TodoItems todoItems = new TodoItems(); todoItems.Clear(); //act Todo[] itemArray = todoItems.FindAll(); //assert Assert.Empty(itemArray); }
public static void Reorder(this ITodoListItemsContract contract, Int64 todoListId, TodoItems list) { contract.Reorder(todoListId.ToString(), list); }