public async Task <IActionResult> Edit(int id, [Bind("id,Station,UzFilia,TimeOfArrive,TimeOfDepet,TrainInfo,ImgTrain")] StationsShadule stationsShadule) { if (id != stationsShadule.id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(stationsShadule); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StationsShaduleExists(stationsShadule.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(stationsShadule)); }
public void CreateAction([FromBody] string data) { StationsShadule stationsShadule = JsonConvert.DeserializeObject <StationsShadule>(data); _context.StationsShadules.Add(stationsShadule); _context.SaveChanges(); }
public async Task <IActionResult> Create([Bind("id,Station,UzFilia,TimeOfArrive,TimeOfDepet,TrainInfo,ImgTrain")] StationsShadule stationsShadule) { //if (ModelState.IsValid) //{ _context.Add(stationsShadule); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); //} return(View(stationsShadule)); }
private void Save_Click(object sender, RoutedEventArgs e) { StationsShadule stationsShadule = new StationsShadule { Station = StationCombo.SelectedItem.ToString(), TimeOfArrive = DateTime.Parse(TimeArrive.Text, System.Globalization.CultureInfo.InvariantCulture), TimeOfDepet = DateTime.Parse(TimeDepet.Text, System.Globalization.CultureInfo.InvariantCulture), TrainInfo = TrainCombo.SelectedItem.ToString(), ImgTrain = ImgSrc.Text, UzFilia = UzFiliaCombo.SelectedItem.ToString() }; Post.Send("StationsShadules", "CreateAction", this, stationsShadule); this.Close(); }