示例#1
0
        public async Task <IActionResult> Create([Bind("Id,AdminEmail,AdminPassword,CreatedDate,LastLogin,IPAddress,UserAgent")] AdminAuth adminAuth)
        {
            if (string.IsNullOrEmpty(HttpContext.Session.GetString("_logged")))
            {
                HttpContext.Session.SetString("_logged", "masuk");
            }
            if (ModelState.IsValid)
            {
                var insertdb = new AdminAuth();

                var message = adminAuth.AdminPassword;
                var salt    = Salt.Create();
                var hash    = Hash.Create(message, salt);

                insertdb.AdminEmail    = adminAuth.AdminEmail;
                insertdb.Salt          = salt;
                insertdb.AdminPassword = hash;
                insertdb.CreatedDate   = DateTime.Now;
                insertdb.IPAddress     = adminAuth.IPAddress;
                insertdb.IsActive      = 1;
                insertdb.UserAgent     = Request.Headers["User-Agent"];

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

                return(RedirectToAction(nameof(Index)));
            }
            return(View(adminAuth));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Email,SocialMedia,VideoYes,FileUrl,SessionId,RegistrationDate,RegisteredIp,RegisteredUserAgent,UniqueKey,UniqueKeyConfirm,InstagramUrl,FacebookUrl,TwitterUrl,GoogleUrl,LinkedInUrl")] LandingRegistration landingRegistration)
        {
            if (ModelState.IsValid)
            {
                _context.Add(landingRegistration);
                await _context.SaveChangesAsync();

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