public override async Task <ActionResult> HandleAsync([FromBody] CreateStaircaseRequest request, CancellationToken cancellationToken = default) { var Staircase = new Staircase { Id = Guid.NewGuid(), BuildingId = request.BuildingId, CarpetId = request.CarpetId, IsCurved = request.IsCurved, StairCount = request.StairCount, Stairs = new List <Stair>(), Total = request.Total }; for (int i = 0; i < request.StairCount; i++) { Staircase.Stairs.Add(new Stair { StaircaseId = Staircase.Id, CarpetId = request.CarpetId, Height = request.StairHeight, Width = request.StairWidth, Length = request.StairLength, Price = (request.Total / request.StairCount) }); } await _repo.AddAsync(Staircase); await _repo.SaveAsync(); return(Ok(Staircase)); }
public override async Task <ActionResult> HandleAsync(Guid id, CancellationToken cancellationToken = default) { await _repo.DeleteStaircaseAsync(id); await _repo.SaveAsync(); return(Ok()); }