public virtual async Task <ActionResult> AddPredict(Guid MatchID, int STID, double Score) { int UserID = _User.GetUserID(User.Identity.Name.ToLower()); if (_userPrediction.TimeCheck(DateTime.Now, MatchID)) { if (_matchscore.MatchScore(MatchID, STID) != Score) { return(this.Json("False")); } else { int MatchIDold = _userPrediction.IsExist(MatchID, UserID); if (MatchIDold > 0) { _userPrediction.Delete(MatchIDold); var item = new UserPredictionModel { MatchID = MatchID, Point = 0, UserID = UserID, ScoreTitleID = STID, Score = Score }; _userPrediction.Add(item); await _uow.SaveChangesAsync(); return(this.Json("True")); } else { var item = new UserPredictionModel { MatchID = MatchID, Point = 0, UserID = UserID, ScoreTitleID = STID, Score = Score }; _userPrediction.Add(item); await _uow.SaveChangesAsync(); // TempData["Success"]="با موفقیت ثبت شد"; } return(this.Json("True")); } } else { return(this.Json("False")); } }
public void Add(UserPredictionModel viewModel) { var lst = new UserPrediction { MatchID = viewModel.MatchID, Score = viewModel.Score, ScoreTitleID = viewModel.ScoreTitleID, PUserID = viewModel.UserID, Point = 0, PredictionTime = DateTime.Now, TournamentID = viewModel.TournamentID }; _userPrediction.Add(lst); }