public ActionResult TextEdit(int id) { using (var db = new ApplicationDbContext()) { TextEditViewModel model = new TextEditViewModel(); model.text = db.Texts.Where(t => t.Id == id).FirstOrDefault(); return(View(model)); } }
public ActionResult TextUpdate(TextEditViewModel model) { using (var db = new ApplicationDbContext()) { model.text = db.Texts.Where(t => t.Id == model.id).FirstOrDefault(); model.text.Title = model.title; model.text.Description = model.description; db.SaveChanges(); return(Json("data", JsonRequestBehavior.AllowGet)); } }
private void AudioPlayerView_Loaded(object sender, RoutedEventArgs e) { mViewModel = this.DataContext as TextEditViewModel; }