Ejemplo n.º 1
0
        public IActionResult Signup([FromBody] tblUser model)
        {
            try
            {
                model.Email    = model.Email.Trim().ToLower();
                model.Password = model.Password.Trim();
                string  password = model.Password;
                tblUser _tblUser = _ItblUserRepository.Get(x => x.Email.ToLower() == model.Email).FirstOrDefault();
                if (_tblUser != null)
                {
                    return(BadRequest("Email already exists"));
                }
                else
                {
                    model.Password    = EncryptUtil.EncryptString(model.Password);
                    model.IsActive    = true;
                    model.CreatedDate = DateTime.Now;
                    _ItblUserRepository.Add(model);
                    model.Password = password;
                }

                return(Ok(model));
            }
            catch (Exception ex)
            {
                log.Fatal("signup:", ex);
                return(BadRequest(ex));
            }
        }