public async Task <IActionResult> Edit(int id, [Bind("Id,Description,DueDate,Complete,IdNetUsers")] TodoItem todoItem)
        {
            if (id != todoItem.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(todoItem);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TodoItemExists(todoItem.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdNetUsers"] = new SelectList(_context.TodoItem, "Id", "Description", todoItem.IdNetUsers);
            return(View(todoItem));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Description,DateCreation,DateEcheance,Terminee")] Tache tache)
        {
            if (id != tache.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tache);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TacheExists(tache.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tache));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Title,AddedDate,FinishedDate,Descripion,Priority")] TodoLists todoLists)
        {
            if (id != todoLists.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(todoLists);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TodoListsExists(todoLists.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(todoLists));
        }
Ejemplo n.º 4
0
        public bool UpdateList(List list)
        {
            try
            {
                _context.Update(list);
                _context.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                return(false);
            }
            catch (DbUpdateException)
            {
                return(false);
            }

            return(true);
        }