Ejemplo n.º 1
0
        public async void HeleprsFunctinalityTest()
        {
            _token = await _accountManagementService.SignIn(TestingObjectProvider.Instance.Login);

            Assert.NotNull(_token);

            var helper = TestingObjectProvider.Instance.Helper;

            Assert.NotNull(_helpersManagementService.GetAllHelpers(_token.Jwt).Result);
            Assert.True(_helpersManagementService.CreateHelper(helper, _token.Jwt).Result);
            Assert.True(_helpersManagementService.DeleteHelper(helper.Id, _token.Jwt).Result);
            Assert.NotNull(_helpersManagementService.GetHelper(helper.Id, _token.Jwt).Result);
            Assert.True(_helpersManagementService.UpdateHelper(helper, _token.Jwt).Result);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Index(CancellationToken cancellationToken)
        {
            List <Pet> pets = await _petsManagementService.GetAllPets(CurrentCookiesToken, cancellationToken);

            List <PetViewModel> viewModel = new List <PetViewModel>();

            if (pets == null)
            {
                return(View());
            }

            foreach (var pet in pets)
            {
                viewModel.Add(new PetViewModel
                {
                    ThePet       = pet,
                    ThePetStatus = string.IsNullOrEmpty(pet.PetsStatus)
                        ? new PetsStatus {
                        Name = StringLocalizer["Lack"]
                    }
                        : await _petsStatusManagementService.GetStatus(pet.PetsStatus, CurrentCookiesToken, cancellationToken),
                    TheHelper = string.IsNullOrEmpty(pet.HelperId)
                        ? new Helper {
                        Address = "TOZ"
                    }
                        : await _helpersManagementService.GetHelper(pet.HelperId, AuthService.ReadCookie(HttpContext, AppSettings.CookieTokenName, true), cancellationToken)
                });

                if (!string.IsNullOrEmpty(pet.ImageUrl))
                {
                    try
                    {
                        var downloadedImg = _filesManagementService.DownloadImage(_appSettings.Value.BaseUrl + pet.ImageUrl);

                        if (downloadedImg != null)
                        {
                            var thumbnail = _filesManagementService.GetThumbnail(downloadedImg);
                            pet.Photo = _filesManagementService.ImageToByteArray(thumbnail);
                        }
                    }
                    catch (HttpRequestException)
                    {
                        pet.Photo = null;
                    }
                    catch (AggregateException)
                    {
                        pet.Photo = null;
                    }
                }
            }
            return(View(viewModel.OrderByDescending(x => x.ThePet.Created).ThenByDescending(x => x.ThePet.LastModified)));
        }
Ejemplo n.º 3
0
 public async Task <ActionResult> Edit(string id, CancellationToken cancellationToken)
 {
     return(PartialView("Edit", await _helpersManagementService.GetHelper(id, AuthService.ReadCookie(HttpContext, AppSettings.CookieTokenName, true), cancellationToken)));
 }
 public void TestOfGettingSpecifiedHelper()
 {
     Assert.NotNull(_helpersManagementService.GetHelper(_testingHelper.Id, _token.Jwt).Result);
 }