Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,FileName,TypeID")] TRPR.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)));
            }
            return(View(file));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("ID,FileName,TypeID")] TRPR.Models.File file)
        {
            if (ModelState.IsValid)
            {
                _context.Add(file);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(file));
        }