private void btnShowAboutClick(object sender, EventArgs e) { //GET USER BY ID long ID = Convert.ToInt64(txtId.Text.Trim()); HttpClient client = new HttpClient(); client.BaseAddress = new Uri("https://localhost:44390/"); HttpResponseMessage response = client.GetAsync("user/" + ID).Result; //long id = response.Content.ReadAsStringAsync().Id; UserDOM user = response.Content.ReadAsAsync <UserDOM>().Result; List <UserDOM> userList = new List <UserDOM>(); userList.Add(user); userInfo.DataSource = userList; /*** * SHOW ALL USERS * HttpClient client = new HttpClient(); * client.BaseAddress = new Uri("https://localhost:44390/"); * HttpResponseMessage response = client.GetAsync("user/all").Result; * var user = response.Content.ReadAsAsync<IEnumerable<UserDOM>>().Result; * userInfo.DataSource = user; ***/ }
public ActionResult Edit(int id, UserDOM input) { var user = db.Users.Find(id); user.LoginID = input.LoginID; user.LoginPassword = input.LoginPassword; db.SaveChanges(); return(RedirectToAction("Retrive")); }
public UserModel Create(UserDOM model) { var team = TeamRepository.GetByColor(model.Color); var user = new UserDataModel { Name = model.Name, Email = model.Email, GameCode = model.GameCode, GameNickname = model.GameNickname, Level = model.Level, Password = model.Password, Surname = model.Surname, Username = model.Username, Team = team, RaidsCompleted = 0 }; team.Members.Add(user); return(new UserModel(UserRepository.Save(user))); }
public ActionResult Create(UserDOM input) { var user = new User { LoginID = input.LoginID, LoginPassword = input.LoginPassword }; db.Users.Add(user); db.SaveChanges(); return(RedirectToAction("Index", "Home")); }
public ActionResult Login(UserDOM input) { if (ModelState.IsValid) { var login = userDA.checkLogin(input.LoginID, input.LoginPassword); if (login == true) { FormsAuthentication.SetAuthCookie(input.LoginID, input.RememberMe); return(RedirectToAction("Index", "Home")); } } return(View()); }
private void btnRegisterClick(object sender, EventArgs e) { //CREATE/REGISTER ACCOUNT string name = txtName.Text.Trim(); string surname = txtSurname.Text.Trim(); string username = txtUsername.Text.Trim(); string email = txtEmail.Text.Trim(); string password = txtPassword.Text.Trim(); string nick = txtNickname.Text.Trim(); string pogoCode = txtPoGOCode.Text.Trim(); int level = Convert.ToInt32(txtLevel.Text.Trim()); string color = txtColor.Text; if (name == "" || surname == "" || username == "" || email == "" || password == "" || nick == "" || pogoCode == "" || level < 1 && level > 40 || color == "") { MessageBox.Show("Empty fields or incorrect values", "Error"); } UserDOM user = new UserDOM() { Name = name, Surname = surname, Username = username, Email = email, Password = password, GameNickname = nick, GameCode = pogoCode, Level = level, Color = color }; HttpClient client = new HttpClient(); client.BaseAddress = new Uri("https://localhost:44390/"); HttpResponseMessage response = client.PostAsJsonAsync("user/register", user).Result; MessageBox.Show("Successfully registered", "Register"); new Home().Show(); this.Hide(); }
private void btnSaveProfileClick(object sender, EventArgs e) { //SAVE CHANGES, UPDATE USER string name = txtName.Text; string surname = txtSurname.Text; string email = txtEmail.Text; string password = txtPassword.Text; string pogoCode = txtPoGoCode.Text; string nickname = txtNickname.Text; if (name == "" || surname == "" || email == "" || password == "" || nickname == "" || pogoCode == "") { MessageBox.Show("Empty fields or incorrect values", "Error"); } UserDOM user = new UserDOM() { Name = name, Surname = surname, Email = email, Password = password, GameNickname = nickname, GameCode = pogoCode, }; HttpClient client = new HttpClient(); client.BaseAddress = new Uri("https://localhost:44390/"); HttpResponseMessage response = client.PutAsJsonAsync("user/", user).Result; MessageBox.Show("Successfully edited", "Edit profile"); new Home().Show(); this.Hide(); }
public void Update(long id, UserDOM model) { UserRepository.Update(id, model.Name, model.Surname, model.Username, model.GameNickname, model.Email, model.Password, model.Level); }
public void Update(long id, [FromBody] UserDOM model) { Service.Update(id, model); }
public UserModel Create(UserDOM model) { return(Service.Create(model)); }