private async Task <bool> CreateOrUpdateTireInstallmentAsync(TireInstallmentModel m) { try { string userNo = HttpContext.User.Identity.Name; using (var productclient = new Tuhu.Service.Product.ProductConfigClient()) { string content = await GetModifyLogStringAsync(m); var log = new TireInstallmentConfigLog() { PID = m.PID, User = userNo, Content = content }; var createresult = await productclient.CreateOrUpdateTireInstallmentAsync(m); createresult.ThrowIfException(true); var logresult = await productclient.LogTireInstallmentConfigAsync(log); return(true); } } catch (System.Exception ex) { return(false); } }
public async Task <JsonResult> BatchSaveTireInstallmentConfigAsync(TireInstallmentModel model, IEnumerable <string> pids) { JsonResult jr = new JsonResult(); try { foreach (var pid in pids) { using (var logclient = new Tuhu.Service.Product.ProductConfigClient()) { using (var client = new Tuhu.Service.Product.ProductConfigClient()) { model.PID = pid; string userNo = HttpContext.User.Identity.Name; string content = await GetModifyLogStringAsync(model); var log = new TireInstallmentConfigLog() { PID = pid, User = userNo, Content = content }; var result = await client.CreateOrUpdateTireInstallmentAsync(model); result.ThrowIfException(true); var logresult = await logclient.LogTireInstallmentConfigAsync(log); } } } jr.Data = new { code = 1, msg = "操作成功" }; return(jr); } catch (System.Exception ex) { jr.Data = new { code = 0, msg = $"操作失败....ex:{ex}" }; return(jr); } }
public async Task <JsonResult> SaveTireInstallmentConfigAsync(TireInstallmentModel model) { JsonResult jr = new JsonResult(); try { using (var logclient = new Tuhu.Service.Product.ProductConfigClient()) { using (var client = new Tuhu.Service.Product.ProductConfigClient()) { string userNo = HttpContext.User.Identity.Name; string content = await GetModifyLogStringAsync(model); var log = new TireInstallmentConfigLog() { PID = model.PID, User = userNo, Content = content }; var result = await client.CreateOrUpdateTireInstallmentAsync(model); result.ThrowIfException(true); jr.Data = new { code = result.Result > 0 ? 1 : 0, msg = result.Result > 0 ? "操作成功" : "操作失败..." }; var logresult = await logclient.LogTireInstallmentConfigAsync(log); logresult.ThrowIfException(true); return(jr); } } } catch (System.Exception ex) { jr.Data = new { code = 0, msg = $"操作失败....ex:{ex}" }; return(jr); } }