public async Task <IActionResult> UpdateLinComments() { try { string TxtLinComData = null, LinHashId = null, ListFst = string.Empty; IFormCollection formCollection = HttpContext.Request.Form; foreach (string FormPara in formCollection.Keys) { if (FormPara.StartsWith("TxtLinCom")) { LinHashId = FormPara.Replace("TxtLinCom", ""); TxtLinComData = HttpContext.Request.Form[FormPara].Fod(); } else if (FormPara.StartsWith("TxtRealQty")) { ListFst += $"{FormPara.Replace("TxtRealQty", "")}Ç{HttpContext.Request.Form[FormPara].Fod()}|"; } } if (!string.IsNullOrEmpty(LinHashId)) { string data = await ApiClientFactory.Instance.UpdateLinComments(LinHashId, TxtLinComData, ListFst); return(Json(new { data })); } return(Json(new { data = "ok" })); } catch (Exception e1) { return(Json(new { data = e1.ToString() })); } }
public async Task <IActionResult> SendForm() { try { List <string[]> ListSelected = new List <string[]>(); Microsoft.AspNetCore.Http.IFormCollection formCollection = HttpContext.Request.Form; foreach (string FormPara in formCollection.Keys) { if (FormPara.StartsWith("chkS")) { ListSelected.Add(FormPara.Replace("chkS", "").Split('|')); } } if (ListSelected.Count > 0) { IEnumerable <string> ListDispatch = ListSelected.Select(O1 => O1.Fod()).Distinct(); string Idusr = HttpContext.Session.GetObjSession <string>("Session.CodUsr"); string s1 = await ApiClientFactory.Instance.SendForm856(ListDispatch, Idusr); return(Json(new { data = s1 })); } } catch (Exception e3) { return(Json(new { data = e3.ToString() })); } return(Json(new { data = "" })); }