public string Delete([FromBody] string value) { try { ProductInfoes productInfoes = _db.ProductInfoes.Where(b => b.ProductNo == value).First(); _db.ProductInfoes.Remove(productInfoes); _db.SaveChanges(); } catch (Exception ex) { return(ex.Message); } return("success"); }
/// <summary> /// 实物入库 /// </summary> /// <param name="client"></param> public void EntityAccept(ClientAccount client) { EntityAcceptWindow window = new EntityAcceptWindow() { Owner = Application.Current.MainWindow, DataContext = this, }; if (window.ShowDialog() == true) { string product = ""; double price = 0; switch (window.ProductName) { case "黄金": product = "XAU"; price = ProductInfoes.Where(p => p.StockCode.Contains("XAU")).FirstOrDefault().RealTimePrice; break; case "白银": product = "XAG"; price = ProductInfoes.Where(p => p.StockCode.Contains("XAG")).FirstOrDefault().RealTimePrice; break; case "钯金": product = "XPD"; price = ProductInfoes.Where(p => p.StockCode.Contains("XPD")).FirstOrDefault().RealTimePrice; break; case "铂金": product = "XPT"; price = ProductInfoes.Where(p => p.StockCode.Contains("XPT")).FirstOrDefault().RealTimePrice; break; } string deliverNo = DateTime.Now.ToString("yyMMddhhmmsssffff"); ErrType err = _bzjService.CreateDeliverAdmin(client.AccInfo.UserID, _accName, client.AccInfo.AccountName, "1", product, _loginID, deliverNo, (decimal)window.Total, price, 9, (int)_accType); if (err.Err == ERR.SUCCESS) { MessageBox.Show("实物入库成功", "提示信息", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show(err.ErrMsg, err.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Warning); } } }
public string Put([FromBody] ProductInfoes product) { try { ProductInfoes productInfoes = _db.ProductInfoes.Where(b => b.ProductNo == product.ProductNo).First(); productInfoes.Capcity = Convert.ToInt32(product.Capcity); productInfoes.EffectiveMonth = Convert.ToInt32(product.EffectiveMonth); productInfoes.EffectiveDay = Convert.ToInt32(product.EffectiveDay); _db.SaveChanges(); } catch (Exception ex) { return(ex.Message); } return("success"); }