Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("id,NameStationStop,TimeOfArrive,TimeOfDepet,NumberOFTrain")] TrainzStations trainzStations)
        {
            if (id != trainzStations.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(trainzStations);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TrainzStationsExists(trainzStations.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(trainzStations));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("id,NameStationStop,TimeOfArrive,TimeOfDepet,NumberOFTrain")] TrainzStations trainzStations)
        {
            //if (ModelState.IsValid)
            //{
            _context.Add(trainzStations);
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Create)));
            //}
            //return View(trainzStations);
        }