示例#1
0
        public async Task <IActionResult> Edit(ToDo model)
        {
            if (ModelState.IsValid)
            {
                ToDo todo = await _db.ToDos.SingleOrDefaultAsync(x => x.ID == model.ID);

                todo.CopyValues(model, _db);

                // Log for admin
                await _db.Logs.AddAsync(await Log.New("ToDo", $"Task: {todo.Task}, was EDITED", _id, _db));
            }

            return(RedirectToAction("Index", "Todo"));
        }