Пример #1
0
        public async Task <IActionResult> Edit(int?id, [Bind("Id,Name,Path,Size,FolderId")] Models.File file)
        {
            if (id != file.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(file);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FileExists(file.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FolderId"] = new SelectList(_context.Set <Folder>(), "Id", "Id", file.FolderId);
            return(View(file));
        }
Пример #2
0
        public async Task <IActionResult> Edit(int?id, [Bind("Id,Name,DateOfCreate,DateOfChange,Path,Size,UserId")] Folder folder)
        {
            if (id != folder.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(folder);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FolderExists(folder.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(folder));
        }