public void AddPromote(PromoteDto dto) { var entity = dto.ToModel <Promote>(); entity.IsSend = false; promoteRepository.Insert(entity); }
public JsonResult UpSetPromote(PromoteDto Promote) { return(ExceptionCatch.Invoke(() => { Promote.PromoteType = 1; if (Promote.Id > 0) { PromoteService.Instance.UpdatePromote(Promote); } else { PromoteService.Instance.AddPromote(Promote); } })); }
public JsonResult AddGame(int matchId, string content, string raceType, string result, int level, int price) { var dto = new PromoteDto() { MatchId = matchId, Content = content, State = PromoteStateEnum.未开始.ToString(), SendType = SendTypeEnum.短信.ToString(), RaceType = raceType, Result = result, Level = level, Integral = price, PromoteType = 2 }; return(ExceptionCatch.WechatInvoke(() => { PromoteService.Instance.AddPromote(dto); })); }
public void UpdatePromote(PromoteDto dto) { var entity = promoteRepository.Find(x => x.Id == dto.Id).FirstOrDefault(); entity.RaceType = EnumHelper.Parse <RaceTypeEnum>(dto.RaceType); entity.Content = dto.Content; entity.level = dto.Level; entity.Integral = dto.Integral; entity.Price = dto.Price; entity.State = EnumHelper.Parse <PromoteStateEnum>(dto.State); entity.Operator = dto.Operator; entity.SendType = EnumHelper.Parse <SendTypeEnum>(dto.SendType); promoteRepository.Transaction(() => { //推介不中并且未退费,进行退费操作 if (entity.State.Equals(PromoteStateEnum.中) && !entity.IsReturn) { entity.IsReturn = true; ReturnPrice(entity.Price, entity.UserList.ToList()); } promoteRepository.Save(entity); }); }