Ejemplo n.º 1
0
        // GET: Vet
        public ActionResult Index(string sortOrder, string searchString)
        {
            ViewBag.FirstNameSortParam      = string.IsNullOrEmpty(sortOrder) ? "firstName_desc" : "";
            ViewBag.LastNameSortParam       = sortOrder == "lastName" ? "lastName_desc" : "lastName";
            ViewBag.SpecializationSortParam = sortOrder == "specialization" ? "specialization_desc" : "specialization";

            var vets = from v in vetRepository.GetAllVets() select v;

            if (!string.IsNullOrEmpty(searchString))
            {
                vets = vetRepository.SearchString(searchString);
            }
            else
            {
                switch (sortOrder)
                {
                case "firstName_desc":
                    vets = vetRepository.OrderByDescendingParameter("FirstName");
                    break;

                case "lastName_desc":
                    vets = vetRepository.OrderByDescendingParameter("LastName");
                    break;

                case "lastName":
                    vets = vetRepository.OrderByParameter("LastName");
                    break;

                case "specialization_desc":
                    vets = vetRepository.OrderByDescendingParameter("Specialization");
                    break;

                case "specialization":
                    vets = vetRepository.OrderByParameter("Specialization");
                    break;

                default:
                    vets = vetRepository.OrderByParameter("FirstName");
                    break;
                }
            }

            return(View(vets.ToList()));
        }
Ejemplo n.º 2
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"));
        }