Пример #1
0
        public async Task <IResult> Get(string roleId)
        {
            var repositoryResult = await _roleServices.GetByIdAsync(roleId);

            var result = ResponseHandler.GetResult(repositoryResult);

            return(result);
        }
Пример #2
0
        public async Task <ActionResult> Register(FormCollection data)
        {
            var fullName = data["fullName"];
            var email    = data["email"];
            var pass     = data["pass"];
            var address  = data["address"];
            var phone    = data["phone"];
            var users    = _user.Find(filter: x => x.Email.Equals(email));
            var users1   = _user.Find(filter: x => x.Phone.Equals(phone));
            var role     = await _role.GetByIdAsync(2);

            if (users == null)
            {
                if (users1 == null)
                {
                    var user = new User()
                    {
                        FullName = fullName,
                        Email    = email,
                        PassWord = pass,
                        Address  = address,
                        Phone    = phone,
                        Role     = role
                    };
                    await _user.CreateAsync(user);

                    return(RedirectToAction("Login"));
                }
                else
                {
                    ViewBag.error2 = "Số điện thoại này đã được đăng kí!";
                }
            }
            else
            {
                ViewBag.error1 = "Email này đã tồn tại!";
            }
            return(View());
        }