public IActionResult MatchsInsert([FromBody] Matches match) { match.EventDate = match.EventDate.AddHours(-6); db.Matches.Add(match); db.SaveChanges(); return(Json(match)); }
public IActionResult Viewers(string id, string uid) { var matchId = StringCipher.Decrypt(id); //if(!db.Viewers.Any(x => x.MatchId == id && x.Uid == uid)){ var viewer = new Viewers { Uid = uid, MatchId = matchId, Added = DateTime.Now }; db.Viewers.Add(viewer); db.SaveChanges(); //} var total = db.Viewers.Where(x => x.MatchId == matchId).Select(x => x.Uid).Distinct(); return(Json(total.Count())); }