Exemplo n.º 1
0
        // GET: Locations
        public ActionResult Index(bool mapFlag = true)
        {
            var locations = m_repo.GetLocations();

            ViewBag.MapFlag = mapFlag;
            if (
                locations.IsNullOrEmpty())
            {
                return(RedirectToAction("Create"));
            }
            else
            {
                locations = locations.Where(x => x.MapFlag == mapFlag);
            }
            return(View(locations));
        }
        public ActionResult Edit(int?id)
        {
            if (!id.HasValue)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Map map = m_repo.GetMap(id.Value);

            if (map == null)
            {
                return(HttpNotFound());
            }
            List <Question>          availQuestions = m_repo.GetQuestions(q => q.Retired == false && q.GenusId == map.GenusId).ToList();
            MapQuestionListViewModel mapQuestion    = map.ToMapQuestionListViewModel(availQuestions);

            ViewBag.Location = new SelectList(m_repo.GetLocations(), "Id", "Name");
            var crossTypes = m_repo.GetCrossTypes().Where(t => t.GenusId == map.GenusId && t.Retired == false);

            ViewBag.CrossTypes = new SelectList(crossTypes, "Id", "Name");

            return(View(mapQuestion));
        }
        public IEnumerable <DataListViewModel> SearchLocations(string term, int recordsToReturn)
        {
            IEnumerable <Location> locations = u_repo.GetLocations(term, recordsToReturn, true);

            return(locations.ToDataListViewModel());
        }