public JsonResult Create(GMarketType obj) { try { NSession.SaveOrUpdate(obj); NSession.Flush(); } catch (Exception ee) { return Json(new { errorMsg = "出错了" }); } return Json(new { IsSuccess = "true" }); }
public string GMarket(string ItemId, string ItemTitle, decimal Price, string PicUrl, string Nownum, int Qty, string ProductUrl, string Account) { try { GMarketType obj = new GMarketType(); obj.ItemId = ItemId; obj.ItemTitle = ItemTitle; obj.Price = Price; obj.PicUrl = PicUrl; obj.NowNum = Nownum; obj.ProductUrl = ProductUrl; obj.Account = Account; obj.Qty = Qty; obj.CreateOn = DateTime.Now; int check = GetId(ItemId, Nownum); if (check > 0) { obj.Id = check; NSession.Update(obj); NSession.Flush(); return "更新一条记录成功"; } NSession.Save(obj); NSession.Flush(); } catch (Exception ex) { return "保存失败"; } return "保存一条记录成功"; }