Пример #1
0
        public async Task <IActionResult> Create([Bind("Id,SliceId,UserId,Title,PostText,Comments,Likes,Dislikes,PostDate")] Post post)
        {
            if (ModelState.IsValid)
            {
                _context.Add(post);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(post));
        }
        public async Task <IActionResult> Create([Bind("Name,Description,UserId")] Slice slice)
        {
            if (ModelState.IsValid)
            {
                _context.Add(slice);
                await _context.SaveChangesAsync();

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