protected void Save_Clicked(object sender, EventArgs e) { var heading = Heading.Text; var myTranslation = HttpUtility.HtmlDecode(MyTranslation.Text); var footnote = HttpUtility.HtmlDecode(Footnote.Text); var newPara = NewPara.Checked; var surah = int.Parse(Request["surah"] ?? "1"); var ayah = int.Parse(Request["ayah"] ?? "1"); using (var quran = new QuranContext()) { var existingTranslation = quran.MyTranslations.FirstOrDefault(t => t.SurahNo == surah && t.AyahNo == ayah); if (existingTranslation == null) { var newTranslation = new MyTranslation { AyahNo = ayah, SurahNo = surah, Heading = heading, Translation = myTranslation, Footnote = footnote, NewParaAfterThis = newPara, CreatedDate = DateTime.Now, LastUpdateDate = DateTime.Now }; quran.MyTranslations.Add(newTranslation); quran.SaveChanges(); } else { existingTranslation.NewParaAfterThis = newPara; existingTranslation.SurahNo = surah; existingTranslation.AyahNo = ayah; existingTranslation.Heading = heading; existingTranslation.Translation = myTranslation; existingTranslation.Footnote = footnote; existingTranslation.LastUpdateDate = DateTime.Now; quran.SaveChanges(); } } }
protected void SaveBanglaMeanings_Clicked(object sender, EventArgs e) { var surah = int.Parse(Request["surah"] ?? "1"); var ayah = int.Parse(Request["ayah"] ?? "1"); var word = int.Parse(Request["word"] ?? "1"); using (QuranContext quran = new QuranContext()) { var meaning = (from m in quran.Meanings where m.SurahNo == surah && m.VerseNo == ayah && m.WordNo == word select m).First(); var root = (from r in quran.Roots where r.ID == meaning.RootID select r).First(); root.BanglaMeanings = BanglaMeanings.Text.Trim(); quran.SaveChanges(); } }