コード例 #1
0
        public async Task <IActionResult> Create([Bind("EntryID,Date,Text")] Entry entry)
        {
            if (ModelState.IsValid)
            {
                _context.Add(entry);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(entry));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("DiaryID,Title,CreatedDate")] Diary diary)
        {
            if (ModelState.IsValid)
            {
                _context.Add(diary);
                await _context.SaveChangesAsync();

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