public ActionResult Generate(int RequestedPets) { PetHelper helper = new PetHelper(); helper.ClearAllPets(); helper.GeneratePets(RequestedPets); return(View("success")); }
public void Check_Whether_GetOwnerViewModelByCat_Returns_empty_viewModel() { List <OwnerModel> ownerList = null; Mock <ILogger <PetHelper> > mockLoggerService = new Mock <ILogger <PetHelper> >(); PetHelper helper = new PetHelper(mockLoggerService.Object); OwnerViewModel ownerViewModel = helper.GetOwnerViewModelByCat(ownerList); Assert.NotNull(ownerViewModel); Assert.Null(ownerViewModel.MaleOwnerCatList); Assert.Null(ownerViewModel.FemaleOwnerCatList); }
public void Check_Whether_GetOwnerViewModelByCat_Returning_Correct_Value() { List <OwnerModel> ownerList = PrepareData(); Mock <ILogger <PetHelper> > mockLoggerService = new Mock <ILogger <PetHelper> >(); PetHelper helper = new PetHelper(mockLoggerService.Object); OwnerViewModel ownerViewModel = helper.GetOwnerViewModelByCat(ownerList); Assert.NotNull(ownerViewModel); Assert.Equal(3, ownerViewModel.FemaleOwnerCatList.Count); Assert.Equal(2, ownerViewModel.MaleOwnerCatList.Count); }
public ActionResult Index(string tagName = "") { PetHelper helper = new PetHelper(); PetCollectionViewModel model = new PetCollectionViewModel(); model.TagName = tagName; // Time model data retrieval Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); model.Pets = helper.GetPets(UseCache, model.TagName); stopwatch.Stop(); model.TimeInfo = FormatTimeElapsed(stopwatch.Elapsed, UseCache); return(View("default", model)); }
private void PetView_Loaded(object sender, RoutedEventArgs e) { kindCombobox.ItemsSource = PetHelper.AnimalKinds(); if (isUpdate == true) { addPetButton.Visibility = Visibility.Collapsed; closeButton.Visibility = Visibility.Collapsed; birthdateDatePicker.Date = pet.BirthDate.Date; DataContext = pet; petInformation.DataContext = pet; } else { updateButton.Visibility = Visibility.Collapsed; deleteButton.Visibility = Visibility.Collapsed; } }
private void OnPet_Updated(object sender, Telerik.Sitefinity.Data.ExecutingEventArgs e) { if (e.CommandName == "CommitTransaction" || e.CommandName == "FlushTransaction") { var provider = sender as DynamicModuleDataProvider; var dirtyItems = provider.GetDirtyItems(); if (dirtyItems.Count != 0) { PetHelper petHelper = new PetHelper(); foreach (var item in dirtyItems) { if (item.GetType() == TypeResolutionService.ResolveType(petHelper.PetTypeString)) { petHelper.FlushCache(); } } } } }
private void kindCombobox_SelectionChanged(object sender, SelectionChangedEventArgs e) { string selected = kindCombobox.SelectedItem.ToString(); if (selected == "Kedi") { breedcombobox.ItemsSource = PetHelper.catBreeds(); } else if (selected == "Köpek") { breedcombobox.ItemsSource = PetHelper.dogBreeds(); } else if (selected == "Kuş") { breedcombobox.ItemsSource = PetHelper.birdBreeds(); } else if (selected == "Diğer") { breedcombobox.ItemsSource = PetHelper.otherBreeds(); } }
public async Task <List <PetModel> > Pets() { List <PetModel> list = new List <PetModel>(); var data = await ParseObject.GetQuery("Pets").WhereEqualTo("user", ParseUser.CurrentUser).FindAsync(); foreach (ParseObject obj in data) { var model = new PetModel() { User = ParseUser.CurrentUser, Name = obj.Get <string>("name"), Kind = obj.Get <string>("kind"), Breed = obj.Get <string>("breed"), BirthDate = obj.Get <DateTime>("birthdate"), Picture = (obj.ContainsKey("picture") == true && obj["picture"] != null) ? obj.Get <ParseFile>("picture") : null }; model.ObjectId = obj.ObjectId; model.Logo = (model.Picture != null) ? model.Picture.Url.OriginalString : PetHelper.PetImage(model.Kind); list.Add(model); } return(list); }