Beispiel #1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(IStory).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!IStoryExists(IStory.Id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Create"));
        }
Beispiel #2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Storyes.Add(IStory);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Create"));
        }
Beispiel #3
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            IStory = await _context.Storyes.FindAsync(id);

            if (IStory != null)
            {
                _context.Storyes.Remove(IStory);
                await _context.SaveChangesAsync();
            }

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