diff --git a/Beam.Client/Services/BeamApiService.cs b/Beam.Client/Services/BeamApiService.cs index 0ea1c99..9bfe9e3 100644 --- a/Beam.Client/Services/BeamApiService.cs +++ b/Beam.Client/Services/BeamApiService.cs @@ -40,7 +40,9 @@ internal async Task> AddRay(Ray ray) internal async Task GetOrCreateUser(string name) { - return (await http.GetFromJsonAsync($"api/User/Get/{name}")) ?? new User(); + var resp = await http.PostAsync($"api/User/Get/{name}", null); + resp.EnsureSuccessStatusCode(); + return (await resp.Content.ReadFromJsonAsync()) ?? new User(); } internal async Task> PrismRay(Prism prism) @@ -51,7 +53,9 @@ internal async Task> PrismRay(Prism prism) internal async Task> UnPrismRay(int rayId, int userId) { - return (await http.GetFromJsonAsync>($"api/Prism/Remove/{userId}/{rayId}")) ?? new List(); + var resp = await http.DeleteAsync($"api/Prism/Remove/{userId}/{rayId}"); + resp.EnsureSuccessStatusCode(); + return (await resp.Content.ReadFromJsonAsync>()) ?? new List(); } internal async Task> UserRays(string name) diff --git a/Beam.Server/Controllers/PrismController.cs b/Beam.Server/Controllers/PrismController.cs index b320892..b372c2d 100644 --- a/Beam.Server/Controllers/PrismController.cs +++ b/Beam.Server/Controllers/PrismController.cs @@ -35,7 +35,7 @@ public List Add([FromBody] Prism prism) .ToList(); } - [HttpGet("[action]/{UserId}/{RayId}")] + [HttpDelete("[action]/{UserId}/{RayId}")] public List Remove(int UserId, int RayId) { var removePrisms = _context.Prisms.Include(p => p.Ray).Where(p => p.RayId == RayId && p.UserId == UserId).ToList(); @@ -53,4 +53,4 @@ public List Remove(int UserId, int RayId) } } -} \ No newline at end of file +} diff --git a/Beam.Server/Controllers/UserController.cs b/Beam.Server/Controllers/UserController.cs index 13f9159..fc9c778 100644 --- a/Beam.Server/Controllers/UserController.cs +++ b/Beam.Server/Controllers/UserController.cs @@ -15,7 +15,7 @@ public UserController(Data.BeamContext context) _context = context; } - [HttpGet("[action]/{Username}")] + [HttpPost("[action]/{Username}")] public User Get(string Username) { var existingUser = _context.Users.FirstOrDefault(u => u.Username == Username); @@ -31,4 +31,4 @@ public User Get(string Username) } } -} \ No newline at end of file +}