public void InsterRecord(string TextId, string Text, string LanguageCode) { AdminInput input = new AdminInput(); input.TextId = TextId; input.Text = Text; input.LanguageCode = LanguageCode; if (this.doesTextIdExist(input) == false) { input.TextId = input.TextId; Text text = new Text(); text.TextId = input.TextId; text.System = true; Translation translation = new Translation(); translation.LanguageCode = input.LanguageCode; translation.TextId = text.TextId; translation.Translated_Text = input.Text; translation.OfficialBoolean = true; translation.Votes = 0; TranslationLog translation_log = new TranslationLog(); translation_log.TextId = input.TextId; translation_log.System_Date = DateTime.Now; translation_log.LanguageCode = input.LanguageCode; translation_log.Translated_Text = input.Text; ITranslation.InsertTextTranslation(text, translation, translation_log); } }
public ActionResult Create(AdminInput input) { if (!ModelState.IsValid) { return(PartialView(input)); } if (this.doesTextIdExist(input) == true) { return(PartialView(input)); } else { input.TextId = input.TextId; Text text = new Text(); text.TextId = input.TextId; text.System = true; Translation translation = new Translation(); translation.LanguageCode = input.LanguageCode; translation.TextId = text.TextId; translation.Translated_Text = input.Text; translation.OfficialBoolean = true; translation.Votes = 0; TranslationLog translation_log = new TranslationLog(); translation_log.TextId = input.TextId; translation_log.System_Date = DateTime.Now; translation_log.LanguageCode = input.LanguageCode; translation_log.Translated_Text = input.Text; ITranslation.InsertTextTranslation(text, translation, translation_log); // returning the key to call grid.api.update var data = this.Gridformat(); var rowData = data.GridRows.Where(x => x.TextId == input.TextId).FirstOrDefault(); if (System.Web.HttpContext.Current.Request.Cookies["MissingTrans"] != null) { if (System.Web.HttpContext.Current.Request.Cookies["MissingTrans"].Value != "true") { return(Json(MapToGridModel(rowData))); } else { return(Json(rowData)); } } else { return(Json(rowData)); } } }