Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("TopicId,TopicTitle,TopicDescription")] Topics topics)
        {
            if (ModelState.IsValid)
            {
                _context.Add(topics);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(topics));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("UserId,UserName,UserEmail,UserPassword,UserRegistrationDate,UserBirthdate,UserLastOnline,UserIsAdmin")] Users users)
        {
            if (ModelState.IsValid)
            {
                _context.Add(users);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(users));
        }
Esempio n. 3
0
        public async Task <IActionResult> Create([Bind("ThreadId,UserId,TopicId,ThreadTitle,ThreadIsLocked")] Threads threads)
        {
            if (ModelState.IsValid)
            {
                _context.Add(threads);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TopicId"] = new SelectList(_context.Topics, "TopicId", "TopicTitle", threads.TopicId);
            ViewData["UserId"]  = new SelectList(_context.Users, "UserId", "UserEmail", threads.UserId);
            return(View(threads));
        }
Esempio n. 4
0
        public async Task <IActionResult> Create([Bind("MessagesId,MessageContents,MessageCreationDate,MessageModificationDate,UserId,ThreadId")] Messages messages)
        {
            if (ModelState.IsValid)
            {
                _context.Add(messages);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ThreadId"] = new SelectList(_context.Threads, "ThreadId", "ThreadTitle", messages.ThreadId);
            ViewData["UserId"]   = new SelectList(_context.Users, "UserId", "UserEmail", messages.UserId);
            return(View(messages));
        }