public ActionResult KittyJusticeLeagueUpdateWinner(KittyJusticeLeagueModel model) { try { if (common.Now >= new DateTime(2017, 12, 18)) { throw new KittyJusticeLeagueServiceException("400", "이벤트가 종료되었습니다.", null); } // 당첨자 세션 check long?entryId = Session["KittyJusticeLeagueEntryId"] as long?; KittyJusticeLeagueInstantLotteryPrizeType?prize = Session["KittyJusticeLeaguePrizeType"] as KittyJusticeLeagueInstantLotteryPrizeType?; if (!entryId.HasValue || entryId.Value != model.Id) { throw new KittyJusticeLeagueServiceException("400", "당첨자가 아닙니다.", model.Id); } if (!prize.HasValue || prize.Value != model.PrizeType) { throw new KittyJusticeLeagueServiceException("400", "해당 경품 당첨자가 아닙니다.", model.PrizeType); } var user = service.GetInstantLotteryWinner(model.Id); var entity = mapperConfig.CreateMapper().Map <KittyJusticeLeagueModel, KittyJusticeLeagueInstantLottery>(model, user); entity.UpdateDate = common.Now; service.UpdateInstantLotteryWinner(entity); return(Json(new { result = true })); } catch (Exception e) { return(Json(new { result = false, message = e.Message })); } }
public void KittyJusticeLeagueUpdateWinner(KittyJusticeLeagueModel model) { // 당첨자 세션 check long?entryId = HttpContext.Current.Session["KittyJusticeLeagueEntryId"] as long?; KittyJusticeLeagueInstantLotteryPrizeType?prize = HttpContext.Current.Session["KittyJusticeLeaguePrizeType"] as KittyJusticeLeagueInstantLotteryPrizeType?; if (!entryId.HasValue || entryId.Value != model.Id) { throw new KittyJusticeLeagueServiceException("400", "당첨자가 아닙니다.", model.Id); } if (!prize.HasValue || prize.Value != model.PrizeType) { throw new KittyJusticeLeagueServiceException("400", "해당 경품 당첨자가 아닙니다.", model.PrizeType); } var user = service.GetInstantLotteryWinner(model.Id); var entity = mapperConfig.CreateMapper().Map <KittyJusticeLeagueModel, KittyJusticeLeagueInstantLottery>(model, user); entity.UpdateDate = common.Now; service.UpdateInstantLotteryWinner(entity); }