public string Get() { var re = this.Request; var headers = re.Headers; string username = ""; string password = ""; try { username = headers.GetCommaSeparatedValues("username").First(); password = headers.GetCommaSeparatedValues("username").First(); } catch (Exception e) { } User buffer = userManager.checkUser(username, password); userManager.GenerateToken(buffer); buffer = userManager.checkUser(username, password); clientUser userToSend = new clientUser { Username = buffer.Username, Token = buffer.Token }; string json = JsonSerializer.Serialize(userToSend); return(json); }
public bool Delete(clientUser UserID) { serverUserModel SUM = Users.Where(t => t.ID == UserID.ID).FirstOrDefault(); if (SUM != null) { Users.Remove(SUM); return(true); } return(false); }
public bool Update(clientUser user) { serverUserModel SUM = Users.Where(t => t.ID == user.ID).FirstOrDefault(); if (SUM != null) { SUM.Name = user.Name; SUM.Username = user.Username; return(true); } return(false); }
public IActionResult Post([FromBody] clientLoginModel value) { LoginCheck checkLogin = new LoginCheck(); clientUser clientUserModel = checkLogin.Check(value); if (clientUserModel != null) { return(Ok(clientUserModel)); } else { return(BadRequest("Invalid Username or Password")); } }