示例#1
0
        public bool AddTournamentPrediction(UserMatchPredictionModel model)
        {
            using (var scope = new TransactionScope())
            {
                try
                {
                    foreach (var answer in model.Answers)
                    {
                        _tournament.AddUserQuestionAnswer(new MatchQuestionUserAnswerModel()
                        {
                            UserId          = model.UserId,
                            MatchQuestionId = answer.MatchQuestionId,
                            Answer          = answer.Answer
                        });
                    }

                    scope.Complete();
                    return(true);
                }
                catch (Exception ex)
                {
                    scope.Dispose();
                    JavaScriptSerializer js = new JavaScriptSerializer();
                    string json             = js.Serialize(model);
                    Log.Error("BL-Tournament - AddTournamentPrediction" + json, ex);
                    throw new ReturnExceptionModel(new CustomExceptionModel()
                    {
                        StatusCode = HttpStatusCode.BadRequest, Message = ex.Message
                    });
                }
            }
        }