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)); }
public void Execute() { var rnd = new Random(); var id = rnd.Next(1, 101); userStore.AddUser(new User { Id = id, Name = $"User {id}" }); }
public User Register(string name, string username, string password) { var user = new User() { Name = name, Password = password, Username = username }; _store.AddUser(user); return(user); }
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()); }
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); }
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); }
public int AddUser(User user) { return(UserStore.AddUser(user)); }
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); }