Ejemplo n.º 1
0
        public async Task <JsonResult> RegisterRequest(Account info)
        {
            var account = await _account.FindAsync(x => x.Email.ToLower().Equals(info.Email.ToLower()));

            if (account != null)
            {
                return(Json(new { success = false }, JsonRequestBehavior.AllowGet));
            }
            info.Password = info.Password.Encrypt();
            Account newAccount = new Account()
            {
                FirstName   = info.FirstName,
                LastName    = info.LastName,
                Password    = info.Password,
                Email       = info.Email,
                Role        = RoleUser.Customer,
                CreatedDate = DateTime.Now
            };
            await _account.CreateAsync(newAccount);

            return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
        }