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("保存一条记录成功"); }
public ActionResult Edit(GMarketType obj) { try { NSession.Update(obj); NSession.Flush(); } catch (Exception ee) { return(Json(new { errorMsg = "出错了" })); } return(Json(new { IsSuccess = "true" })); }
/// <summary> /// 根据Id获取 /// </summary> /// <param name="Id"></param> /// <returns></returns> public GMarketType GetById(int Id) { GMarketType obj = NSession.Get <GMarketType>(Id); if (obj == null) { throw new Exception("返回实体为空"); } else { return(obj); } }
public JsonResult DeleteConfirmed(int id) { try { GMarketType obj = GetById(id); NSession.Delete(obj); NSession.Flush(); } catch (Exception ee) { return(Json(new { errorMsg = "出错了" })); } return(Json(new { IsSuccess = "true" })); }
public ActionResult Edit(int id) { GMarketType obj = GetById(id); return(View(obj)); }