public ActionResult BonusPointData_10() { Dictionary<string, string> sitemaster = GetSiteMaster(); ViewData["SiteMaster"] = sitemaster; int UserId = Convert.ToInt32(sitemaster["userid"]); int Type = 10; BonusPointDataDao Dao = new BonusPointDataDao(); int Count = Dao.GetCountByUserIdAndTypeId(UserId, Type); BonusPointData Obj = new BonusPointData(); if (Count == 0) { MakeBidDocZJDao Daozj = new MakeBidDocZJDao(); IList<MakeBidDocZJ> ObjzjList = Daozj.FindByUserId(UserId); MakeBidDocZJ Objzj = new MakeBidDocZJ(); if (ObjzjList != null && ObjzjList.Count != 0) { Objzj = ObjzjList.First(); } Obj.Label1 = Objzj.Label9; Obj.Label2 = Objzj.Label10; Obj.Label3 = Objzj.Label11; Obj.UserId = UserId; Obj.Type = Type; Dao.Insert(Obj); return View(Obj); } else { Obj = Dao.FindByUserIdAndTypeId(UserId, Type); return View(Obj); } }
public ContentResult BonusPointData_Save(BonusPointData Obj) { Dictionary<string, string> sitemaster = GetSiteMaster(); ViewData["SiteMaster"] = sitemaster; int UserId = Convert.ToInt32(sitemaster["userid"]); BonusPointDataDao Dao = new BonusPointDataDao(); //BonusPointData Model = Dao.FindByUserIdAndTypeId( Obj.UserId = UserId; try { Dao.UpdateByUserIdAndTypeId(Obj); return Content("添加成功"); } catch (Exception) { return Content("添加失败"); } }