Ejemplo n.º 1
0
        protected internal void Equipment(Ship ship)
        {
            if (!EquipmentDashboardVisible)
            {
                Loading  = true;
                Selected = ship;
                StateHasChanged();

                if (!HangarService.RetrieveHangarDetailView(ship.ID, out HangarDetailView hangarDetailView, out string message))
                {
                    NotificationService.ShowError(message, "Failed to load equipment!");
                }
                else
                {
                    if (!AccountService.RetrieveAccountVault(out VaultView vaultView, out message, out _))
                    {
                        NotificationService.ShowError(message, "Failed to load vault!");
                    }
                    else
                    {
                        Hangar = hangarDetailView;
                        Vault  = vaultView;
                        EquipmentDashboardVisible = true;
                    }
                }

                Loading = false;
                StateHasChanged();
            }
 public async Task <IActionResult> Activate(int id)
 {
     if (HttpContext.TryGetCurrentSession(out AccountSessionView accountSessionView))
     {
         return(Ok(await HangarService.ActivateHangar(accountSessionView.AccountID, id)));
     }
     return(Ok(ValidatedView.Invalid(ErrorCode.OPERATION_FAILED)));
 }
 public async Task <IActionResult> Post([FromBody] HangarDetailView hangarDetailView)
 {
     if (HttpContext.TryGetCurrentSession(out AccountSessionView accountSessionView))
     {
         return(Ok(await HangarService.UpdateHangar(accountSessionView.AccountID, hangarDetailView)));
     }
     return(Ok(ValidatedView.Invalid(ErrorCode.OPERATION_FAILED)));
 }
 public async Task <IActionResult> Get()
 {
     if (HttpContext.TryGetCurrentSession(out AccountSessionView accountSessionView))
     {
         return(Ok(await HangarService.RetrieveHangarOverviews(accountSessionView.AccountID)));
     }
     return(Ok(ValidatedView <List <HangarOverview> > .Invalid(ErrorCode.OPERATION_FAILED)));
 }
Ejemplo n.º 5
0
        protected internal void SaveEquipment()
        {
            if (EquipmentDashboardVisible)
            {
                Loading = true;
                StateHasChanged();

                if (!HangarService.SaveHangar(Hangar, out string message))
                {
                    NotificationService.ShowError(message, "Failed to save equipment!");
                }
                else
                {
                    NotificationService.ShowSuccess("Equipment saved!");
                }

                Loading = false;
                StateHasChanged();
            }
        }