public User AddUser(float longitude, float latitude)
        {
            int userId      = _userStore.AddUser(longitude, latitude);
            var boundingBox = GetBoundingBox(longitude, latitude, 0);

            _userMap.Add(boundingBox, userId);
            return(_userStore.GetUser(userId));
        }
示例#2
0
        public void Execute()
        {
            var rnd = new Random();
            var id  = rnd.Next(1, 101);

            userStore.AddUser(new User
            {
                Id   = id,
                Name = $"User {id}"
            });
        }
示例#3
0
        public User Register(string name, string username, string password)
        {
            var user = new User()
            {
                Name     = name,
                Password = password,
                Username = username
            };

            _store.AddUser(user);

            return(user);
        }
示例#4
0
        public async Task <IHttpActionResult> Post([FromBody] UserViewModel azureUser)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Missing required fields"));
            }

            try
            {
                await _userStore.AddUser(azureUser);
            }
            catch (Exception e)
            {
                return(InternalServerError(e));
            }

            return(Ok());
        }
示例#5
0
        public IActionResult Register([FromBody] User userToRegistry)
        {
            IActionResult response = BadRequest();
            User          user     = _userStore.GetUserByLogin(userToRegistry.Login);

            if (user != null)
            {
                return(BadRequest(new { error = LoginTakenErrorMessage }));
            }
            _userStore.AddUser(userToRegistry);

            var tokenString = GenerateJSONWebToken(_userStore.GetUserByLogin(userToRegistry.Login));

            response = Ok(new { token = tokenString });


            return(response);
        }
示例#6
0
        async Task Save()
        {
            if (string.IsNullOrWhiteSpace(User.FullName) && string.IsNullOrWhiteSpace(User.UserName) && string.IsNullOrWhiteSpace(User.PassWord))
            {
                await _pageService.DisplayAlert("ERROR", "Please complete all required fields(full name, username, password)", "OK");

                return;
            }

            if (User.Id == 0)
            {
                await _userStore.AddUser(User);

                MessagingCenter.Send(this, Events.UserAdded, User);
            }
            else
            {
                await _userStore.UpdateUser(User);

                MessagingCenter.Send(this, Events.UserUpdated, User);
            }
            await _pageService.PopAsync();
        }
 public async Task AddUser(User user)
 {
     await _userStore.AddUser(user);
 }
示例#8
0
 public int AddUser(User user)
 {
     return(UserStore.AddUser(user));
 }
示例#9
0
 public ActionResult <User> AddUser(User user)
 {
     user.Id = userStore.AddUser(user);
     return(CreatedAtAction(nameof(GetUser), new { user.Id }, user));
 }
 public async Task AddUser(User user)
 {
     IsValidUser(user);
     await _userStore.AddUser(user);
 }