Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("VolunteerId,Name,Surname,Email,VolunteerPassword,PhoneNumber")] Volunteers volunteers)
        {
            if (ModelState.IsValid)
            {
                _context.Add(volunteers);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(volunteers));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("CategoryId,CategoryName,PostId")] Category category)
        {
            if (ModelState.IsValid)
            {
                _context.Add(category);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PostId"] = new SelectList(_context.Posts, "PostId", "PostId", category.PostId);
            return(View(category));
        }
Esempio n. 3
0
        public async Task <IActionResult> Create([Bind("CommentId,Comment,PostId")] Comments comments)
        {
            if (ModelState.IsValid)
            {
                _context.Add(comments);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PostId"] = new SelectList(_context.Posts, "PostId", "PostId", comments.PostId);
            return(View(comments));
        }
Esempio n. 4
0
        public async Task <IActionResult> Create([Bind("UserId,UserName,UserPassword,PostId")] Users users)
        {
            if (ModelState.IsValid)
            {
                _context.Add(users);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PostId"] = new SelectList(_context.Posts, "PostId", "PostId", users.PostId);
            return(View(users));
        }
Esempio n. 5
0
        public async Task <IActionResult> Create([Bind("PostId,Post,UserId,CategoryId")] Posts posts)
        {
            if (ModelState.IsValid)
            {
                _context.Add(posts);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryId"] = new SelectList(_context.Category, "CategoryId", "CategoryId", posts.CategoryId);
            ViewData["UserId"]     = new SelectList(_context.Users, "UserId", "UserId", posts.UserId);
            return(View(posts));
        }
Esempio n. 6
0
        public async Task <IActionResult> Create([Bind("UserId,UserName,UserPassword")] Users users)
        {
            if (ModelState.IsValid)
            {
                users.UserPassword = Crypto.Hash(users.UserPassword);

                _context.Add(users);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(users));
        }
Esempio n. 7
0
        public async Task <IActionResult> Create([Bind("VolunteerId,UserId,VolunteerName,VolunteerSurname,VolunteerUserName,VolunteerEmail,VolunteerPassword,VolunteerPhoneNumber")] Volunteers volunteers)
        {
            if (ModelState.IsValid)
            {
                volunteers.VolunteerPassword = Crypto.Hash(volunteers.VolunteerPassword);

                _context.Add(volunteers);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.Users, "UserId", "UserId", volunteers.UserId);
            return(View(volunteers));
        }