Example #1
0
        public static async Task <IActionResult> ClarificationView <T>(
            this ContestControllerBase <T> that,
            int clarid,
            bool needMore = true)
            where T : class, ICompeteContext
        {
            var toSee = await that.Context.FindClarificationAsync(clarid);

            var clars = Enumerable.Empty <Clarification>();

            if (toSee?.CheckPermission(that.Contest.Team.TeamId) ?? true)
            {
                clars = clars.Append(toSee);

                if (needMore && toSee.ResponseToId.HasValue)
                {
                    int respid = toSee.ResponseToId.Value;
                    var toSee2 = await that.Context.FindClarificationAsync(respid);

                    if (toSee2 != null)
                    {
                        clars = clars.Prepend(toSee2);
                    }
                }
            }

            if (!clars.Any())
            {
                return(that.NotFound());
            }
            that.ViewData["TeamName"] = that.Contest.Team.TeamName;
            return(that.Window(clars));
        }
Example #2
0
 public static IActionResult ClarificationAdd <T>(
     this ContestControllerBase <T> that)
     where T : class, ICompeteContext
 {
     if (that.TooEarly)
     {
         return(that.Message("Clarification", "Contest has not started."));
     }
     else
     {
         return(that.Window(new Models.AddClarificationModel()));
     }
 }