public async Task <IActionResult> Create([Bind("Id,userName,gender,alias,website,socialWebsite,email,dob")] UserModel userModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(userModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(userModel));
        }
        public async Task <IActionResult> Create([Bind("Id,userName,email,profilePicUrl,friendsEmail")] SocialModel socialModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(socialModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(socialModel));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("Id,Name,Headline,Content")] BlogModel blogModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(blogModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(blogModel));
        }
        //[ValidateAntiForgeryToken]
        public async Task <IActionResult> Create([Bind("Id,Name,Content,AuthorEmail")] BlogPost blogPost)
        {
            if (ModelState.IsValid)
            {
                _context.Add(blogPost);
                await _context.SaveChangesAsync();

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