public async Task <IActionResult> Create([Bind("Title,Color")] ToDoItemCreateModel toDoItem) { if (ModelState.IsValid) { await _toDo.AddAsync(new Item <Guid, string> { Color = toDoItem.Color, Title = toDoItem.Title }); return(RedirectToAction(nameof(Index))); } return(View(toDoItem)); }
public async Task <IActionResult> Create([Bind("Title,Color,IsCompleted")] Item <Guid, string> toDoItem) { if (ModelState.IsValid) { await _toDo.AddAsync(new Item <Guid, string> { Color = toDoItem.Color, Title = toDoItem.Title, IsCompleted = toDoItem.IsCompleted, }); return(RedirectToAction(nameof(Index))); //toDoItem.Id = Guid.NewGuid(); //_context.Add(toDoItem); //await _context.SaveChangesAsync(); //return RedirectToAction(nameof(Index)); } return(View(toDoItem)); }
public async Task <ActionResult> Create([Bind("Title,AssignedTo,AssignedBy,TenantId")] ToDoItem todo) { await _todoListService.AddAsync(todo); return(RedirectToAction("Index")); }
public async Task <ActionResult> Create([Bind("Title,Owner")] ToDoItem todo) { await _todoListService.AddAsync(todo); return(RedirectToAction("Index")); }