예제 #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"));
        }
예제 #2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            return(RedirectToPage("./Create"));
        }
예제 #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"));
        }