public async Task <IActionResult> Putaa0003([FromRoute] int id, [FromBody] aa0003 aa0003)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != aa0003.aa0003c01)
            {
                return(BadRequest());
            }

            _context.Entry(aa0003).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!aa0003Exists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <IActionResult> Putaa0002(int id, aa0002 aa0002)
        {
            if (id != aa0002.aa0002c01)
            {
                return(BadRequest());
            }

            _context.Entry(aa0002).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!aa0002Exists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> Putaa0001(aa0001 aa0001)
        {
            _context.Entry(aa0001).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!aa0001Exists(aa0001.aa0001c01))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 4
0
        public async Task <IActionResult> Create([FromBody] aa0002 role)
        {
            MD5    algorithm = MD5.Create();
            string salt      = EncryptData.RandomSalt(12);
            string roleHash  = EncryptData.StringToHash(role.aa0002c21, salt, algorithm);
            aa0002 checkRole = _db.aa0002
                               .Where(a => a.aa0002c21 == roleHash)
                               .Select(a => a).FirstOrDefault();

            if (checkRole != null)
            {
                return(BadRequest(string.Format("This role {0} is exists!", role.aa0002c21)));
            }
            aa0002 outRole = role;

            outRole.aa0002c20 = salt;
            outRole.aa0002c21 = roleHash;
            _db.aa0002.Add(outRole);
            await _db.SaveChangesAsync();

            return(Ok(string.Format("This role {0} is created!", role.aa0002c21)));
        }
Esempio n. 5
0
        public async Task <IActionResult> Putaa0001(aa0001 aa0001)
        {
            //_context.Entry(aa0001).State = EntityState.Modified;
            try
            {
                aa0001 userActive = CheckUser(aa0001.aa0001c11);
                if (userActive != null)
                {
                    userActive.aa0001c01 = aa0001.aa0001c01;
                    userActive.aa0001c07 = aa0001.aa0001c07;
                    userActive.aa0001c08 = aa0001.aa0001c08;
                    userActive.aa0001c11 = aa0001.aa0001c11;
                    userActive.aa0001c12 = aa0001.aa0001c12;
                    userActive.aa0001c13 = aa0001.aa0001c13;
                    userActive.aa0001c14 = aa0001.aa0001c14;
                    userActive.aa0001c55 = aa0001.aa0001c55;
                    userActive.aa0001c16 = aa0001.aa0001c16;
                    userActive.aa0001c17 = aa0001.aa0001c17;
                    userActive.aa0001c25 = aa0001.aa0001c25;
                    _context.Update(userActive);
                    await _context.SaveChangesAsync();

                    return(Ok());
                }
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!aa0001Exists(aa0001.aa0001c01))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public IActionResult ActiveUser([FromQuery] string email)
        {
            aa0001 checkUser = _db.aa0001
                               .Where(a => a.aa0001c13 == email)
                               .Select(a => a).FirstOrDefault();

            if (checkUser == null)
            {
                ViewBag.Message = string.Format("Email {0} invaild!", email);
                return(View());
            }
            checkUser.aa0001c15 = "1";
            checkUser.aa0001c23 = "Actived";
            _db.Update(checkUser);
            _db.SaveChangesAsync();
            ViewBag.Message = string.Format("Email {0} is actived!", email);
            return(View());
        }
        public async Task <IActionResult> Register([FromBody] aa0001 user)
        {
            string checkUser = _context.aa0001
                               .Where(a => a.aa0001c13 == user.aa0001c13)
                               .Select(a => a.aa0001c13).FirstOrDefault();

            if (!string.IsNullOrEmpty(checkUser))
            {
                return(BadRequest(string.Format("This mail {0} is aready exist!", checkUser)));
            }
            MD5    algorithm = MD5.Create();
            string salt      = EncryptData.RandomSalt(12);
            aa0001 outUser   = new aa0001
            {
                aa0001c07 = user.aa0001c13,
                aa0001c08 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                aa0001c11 = user.aa0001c11,
                aa0001c12 = user.aa0001c12,
                aa0001c13 = user.aa0001c13,
                aa0001c14 = user.aa0001c14,
                aa0001c15 = "0",
                aa0001c16 = user.aa0001c16,
                aa0001c20 = salt,
                aa0001c21 = EncryptData.StringToHash(user.aa0001c21, salt, algorithm),
                aa0001c23 = "Not active",
                aa0001c26 = EncryptData.StringToHash(user.aa0001c13, salt, algorithm),
            };

            _context.aa0001.Add(outUser);
            await _context.SaveChangesAsync();

            MailInfo mailInfo = new MailInfo
            {
                mailTo      = outUser.aa0001c13,
                mailSubject = string.Format("Active Account From {0}", baseUrl),
                mailMessage = string.Format("{0}/Account/ActiveUser/?email={1}", baseUrl, outUser.aa0001c13)
            };

            SendMail.SendMailAuto(mailInfo);
            return(Ok("Your are registed! Please check mail and active your account!"));
        }