Exemple #1
0
        public async Task <IActionResult> Edit(int id, Board board)
        {
            if (id != board.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(board);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BoardExists(board.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(board));
        }
Exemple #2
0
        public async Task <bool> EditSize(int id, int width, int height)
        {
            try
            {
                var note = _context.Notes.Find(id);
                note.width  = width;
                note.height = height;

                _context.Update(note);
                await _context.SaveChangesAsync();
            }
            catch (Exception)
            {
                return(false);

                throw;
            }

            return(true);
        }