示例#1
0
        // GET: Routes/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var route = routeRepository.GetRouteByID(id.Value);

            if (route == null)
            {
                return(HttpNotFound());
            }
            return(PartialView(route));
        }
示例#2
0
        // GET: RouteSignals
        public ActionResult Index(int id)
        {
            MOE.Common.Models.ViewModel.RouteEdit.RouteCreateViewModel routeViewModel = new MOE.Common.Models.ViewModel.RouteEdit.RouteCreateViewModel();
            routeViewModel.Route = routeRepository.GetRouteByID(id);
            var signalRepository = MOE.Common.Models.Repositories.SignalsRepositoryFactory.Create();

            foreach (var routeSignal in routeViewModel.Route.RouteSignals)
            {
                if (routeSignal.SignalId != null)
                {
                    Tuple <string, string> tuple = new Tuple <string, string>(routeSignal.Id.ToString(), signalRepository.GetSignalDescription(routeSignal.SignalId));
                    routeViewModel.SignalSelectList.Add(tuple);
                }
            }
            return(View(routeViewModel));
        }
示例#3
0
        public ActionResult Create([Bind(Include = "RouteId,SignalId")] RouteSignal routeSignal)
        {
            MOE.Common.Models.Repositories.IRouteRepository routeRepository = MOE.Common.Models.Repositories.RouteRepositoryFactory.Create();
            var route = routeRepository.GetRouteByID(routeSignal.RouteId);

            if (route.RouteSignals == null)
            {
                route.RouteSignals = new List <RouteSignal>();
            }
            routeSignal.Order = route.RouteSignals.Count + 1;

            if (TryValidateModel(routeSignal))
            {
                routeSignalsRepository.Add(routeSignal);
            }
            return(Content(routeSignal.Id.ToString()));
        }