Пример #1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Documents.Add(Documents);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Пример #2
0
        public async Task <IActionResult> OnGetRemove(int?id)
        {
            if (id == null || !regexItem.IsMatch(id.ToString()))
            {
                return(NotFound());
            }

            DocumentsThingsModel = await _context.DocumentsThings.FindAsync(id);

            if (DocumentsThingsModel != null)
            {
                _context.DocumentsThings.Remove(DocumentsThingsModel);
                await _context.SaveChangesAsync();
            }

            return(Redirect("./Index"));
        }
Пример #3
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null || !regexItem.IsMatch(id.ToString()))
            {
                return(NotFound());
            }
            _context.DocumentsThings.RemoveRange(_context.DocumentsThings.Where(x => x.IdFkd == id));


            if (Documents != null)
            {
                //_context.DocumentsThings.Remove(DcTh);
                // await _context.SaveChangesAsync();

                _context.Documents.Remove(Documents);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }