Ejemplo n.º 1
0
        public void GetAllPetsReturnEmptyListOfPetEntities()
        {
            mockData.Setup(x => x.Pets).Returns(new List <Pet>());
            var result = petRepo.GetAllPets();

            result.Should().BeOfType <List <Pet> >();
            result.Count.Should().Be(0);
        }
Ejemplo n.º 2
0
        // GET: Pet
        public ActionResult Index(string sortOrder, string searchString)
        {
            ViewBag.NameSortParam    = string.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            ViewBag.SpeciesSortParam = sortOrder == "species" ? "species_desc" : "species";
            ViewBag.RaceSortParam    = sortOrder == "races" ? "race_desc" : "races";

            var pets = from p in petRepository.GetAllPets() select p;


            if (!string.IsNullOrEmpty(searchString))
            {
                pets = petRepository.SearchString(searchString);
            }
            else
            {
                switch (sortOrder)
                {
                case "name_desc":
                    pets = petRepository.OrderByDescendingParameter("Name");
                    break;

                case "species_desc":
                    pets = petRepository.OrderByDescendingParameter("Species");
                    break;

                case "species":
                    pets = petRepository.OrderByParameter("Species");
                    break;

                case "race_desc":
                    pets = petRepository.OrderByDescendingParameter("Race");
                    break;

                case "races":
                    pets = petRepository.OrderByParameter("Race");
                    break;

                default:
                    pets = petRepository.OrderByParameter("Name");
                    break;
                }
            }

            return(View(pets.ToList()));
        }
Ejemplo n.º 3
0
        // GET: Consultation/Create
        public ActionResult Create()
        {
            var itemsVet = vetRepository.GetAllVets();

            if (itemsVet != null)
            {
                ViewBag.dataVet = itemsVet;
            }
            var itemsPet = petRepository.GetAllPets();

            if (itemsPet != null)
            {
                ViewBag.dataPet = itemsPet;
            }
            var itemsOwner = ownerRepository.GetAllOwners();

            if (itemsOwner != null)
            {
                ViewBag.dataOwner = itemsOwner;
            }

            return(View("CreateConsultation"));
        }
Ejemplo n.º 4
0
 public ActionResult GetAllPets()
 {
     return(Ok(_petRepository.GetAllPets()));
 }
Ejemplo n.º 5
0
        private ICollection <PetDto> GetAllPets()
        {
            var repo = new PetRepository();

            return(repo.GetAllPets());
        }