public void RegisterUser(RegisterDto dto)
 {
     User entity = new User();
     entity.Username = dto.Username;
     entity.Password = Utils.GeneratePasswordHash(dto.Password);
     entity.Name = dto.Name;
     entity.Surname = dto.Surname;
     _userRepository.Add(entity);
     _userRepository.Save();
 }
        public ActionResult Register(RegisterDto model)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }
            _userService.RegisterUser(model);

            FormsAuthentication.SetAuthCookie(model.Username, false);
            return RedirectToAction("Index", "Home");
        }