public async Task Refresh()
        {
            TotalCost   = 0;
            TotalLength = 0;

            Closets = await ClosetService.GetAllClosetByBuildingIdAsync(BuildingId);

            Staircases = await StaircaseService.GetStaircaseByBuildingIdAsync(BuildingId);

            Rooms = await RoomService.GetAllRoomsByBuildingIdAsync(BuildingId);

            foreach (var Room in Rooms)
            {
                Room.ClosetCount = Closets.Where(c => c.RoomId == Room.Id).ToList().Count();
            }

            TotalLength += CalculateRoomsLength(Rooms);
            TotalCost   += CalculateRoomsTotal(Rooms);
            TotalLength += CalculateStarcasesLength(Staircases);
            TotalCost   += CalculateStaircasesTotal(Staircases);
            TotalLength += CalculateClosetsLength(Closets);
            TotalCost   += CalculateClosetsTotal(Closets);

            TotalLengthHigh = TotalLength * 1.1m;
            TotalCostHigh   = TotalCost * 1.1m;
        }
        public async Task ShowDeleteStaircaseConfirmationModal(Guid id)
        {
            var ConfirmationModal = Modal.Show <Confirmation>("Are you sure you want to delete?");
            var result            = await ConfirmationModal.Result;

            if (!result.Cancelled)
            {
                await StaircaseService.DeleteStaircaseAsync(id);
                await Refresh();
            }
        }
Beispiel #3
0
        public async Task AddNewStaircase(CreateStaircaseRequest NewStaircase)
        {
            NewStaircase.BuildingId = BuildingId;

            NewStaircase.CarpetPrice = Carpet.Where(c => c.Id == NewStaircase.CarpetId).FirstOrDefault().SquareYardPrice;
            NewStaircase.Total       = CalculateTotal(NewStaircase);

            await StaircaseService.AddNewStaircaseAsync(NewStaircase);

            await ModalInstance.CloseAsync();
        }
 protected async override Task OnInitializedAsync()
 {
     Staircase = await StaircaseService.GetStaircaseById(StaircaseId);
 }