Пример #1
0
        public async Task <IActionResult> Create([Bind("Id,Title,Body,Feeling,WordCount,PostedOn")] 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("Id,UserName")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

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