[HttpPost]//添加主题 public async Task <Result> AddDiscuss(addDiscussModel myModel) { int plateId = myModel.plateId; List <int> Ids = myModel.Ids; discuss data = myModel.data; if (plateId == 0) { return(Result.Error()); } var plateData = await _plateBll.GetEntities(u => u.id == plateId).Include(u => u.discusses).ThenInclude(u => u.user).Include(u => u.discusses).ThenInclude(u => u.labels).FirstOrDefaultAsync(); data.time = DateTime.Now; data.user = await _userBll.GetEntities(u => u.id == _user.id).FirstOrDefaultAsync(); data.labels = await _labelBll.GetEntities(u => Ids.Contains(u.id)).ToListAsync(); plateData.discusses.Add(data); _plateBll.Update(plateData); //注意,这里经验可以从redis中获取,现在先设置一个1定值 int level = await _user_extraBll.UpdateExperience(data.user.id, 1, false); return(Result.Success().SetData(new { data.id, level })); }
public Result UpdatePlate(plate myPlate) { _plateBll.Update(myPlate); return(Result.Success()); }