public void UpDownDoubt(string doubtId, string userId, string operation) { using (var biz = new GameBiz.Business.GameBizBusinessManagement()) { biz.BeginTran(); using (var manager = new DoubtManager()) { var entity = manager.GetDoubtById(doubtId); if (entity == null) { throw new ArgumentException("指定编号的问题不存在"); } var record = manager.GetUpDownRecord(userId, doubtId); if (record != null) { throw new ArgumentException("不能重复操作"); } if (operation.ToUpper() == "UP") { entity.UpCount++; } else { entity.DownCount++; } manager.UpdateDoubt(entity); record = new UpDownRecord { UserId = userId, DoubtId = doubtId, UpDown = operation, CreateTime = DateTime.Now, }; manager.AddUpDownRecord(record); } biz.CommitTran(); } }
public void UpdateDoubt(string doubtId, DoubtInfo_Add doubt) { using (var biz = new GameBiz.Business.GameBizBusinessManagement()) { biz.BeginTran(); using (var manager = new DoubtManager()) { var entity = manager.GetDoubtById(doubtId); if (entity == null) { throw new ArgumentException("指定编号的问题不存在"); } entity.Title = doubt.Title; entity.Description = doubt.Description; entity.Category = doubt.Category; entity.UpdateTime = DateTime.Now; entity.UpdateUserKey = doubt.CreateUserKey; entity.UpdateUserDisplayName = doubt.CreateUserDisplayName; manager.UpdateDoubt(entity); } biz.CommitTran(); } }