add saving and deletion of PointClouds

This commit is contained in:
Tim Wundenberg
2021-07-31 16:54:33 +02:00
parent da69c39071
commit bd9410519a
8 changed files with 106 additions and 16 deletions

View File

@@ -40,6 +40,17 @@ namespace PointCloudWeb.Server.Controllers
return ConvertPointCloudToDto(pc);
}
[HttpDelete]
[Route("{id:Guid}")]
public ActionResult RemoveById(Guid id)
{
if (pointCloudService.GetById(id) == null)
return new NotFoundResult();
pointCloudService.RemoveById(id);
return new OkResult();
}
[HttpPut]
public ActionResult<PointCloudInfoDto> UpdatePointCloud([FromBody] PointCloudInfoDto newPc)
{

View File

@@ -122,7 +122,7 @@ namespace PointCloudWeb.Server.Models
public PointCloud GetById(Guid id)
{
return this.Find(pc => pc.Id == id);
return Find(pc => pc.Id == id);
}
public void RemoveById(Guid id)

View File

@@ -68,5 +68,10 @@ namespace PointCloudWeb.Server.Services
foreach (var pointCloud in pointClouds)
RegisterPointCloud(pointCloud.Id);
}
public void RemoveById(Guid id)
{
pointClouds.RemoveById(id);
}
}
}

View File

@@ -32,8 +32,11 @@ namespace PointCloudWeb.Server
}
app.UseRouting();
app.UseCors(options => {
app.UseCors(options =>
{
options.AllowAnyOrigin();
options.AllowAnyMethod();
options.AllowAnyHeader();
});
//app.UseAuthorization();