Beispiel #1
0
        public async Task <IActionResult> Create([Bind("Id,Message")] DbLog dbLog)
        {
            if (ModelState.IsValid)
            {
                _context.Add(dbLog);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(dbLog));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("Id,ChannelName,OwnerId")] Channel channel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(channel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(channel));
        }
Beispiel #3
0
        public async Task <IActionResult> Create([Bind("Id,Login,Email,Gender,DateOfBirth,Password")] User user, string passconf)
        {
            if (ModelState.IsValid)
            {
                var            code    = Helpers.GenerateRandomString(8);
                ActivationCode ActCode = new ActivationCode
                {
                    Code = code,
                    User = user
                };

                _context.Add(user);
                _context.ActivationCodes.Add(ActCode);
                await _context.SaveChangesAsync();

                Helpers.SendActivationEmail(user, code);
                return(View("Activate"));
            }
            return(View());
        }