<commit_before>﻿using System.Collections.Generic;
using System.Linq;
using Sdl.Web.Mvc.Controllers;
using Sdl.Web.Common.Models;
using Sdl.Web.Modules.Ugc.Data;
using Sdl.Web.Modules.Ugc.Models;
using Sdl.Web.Mvc.Configuration;

namespace Sdl.Web.Modules.Ugc.Controllers
{
    /// <summary>
    /// Ugc Controller
    /// </summary>
    public class UgcController : EntityController
    {
        protected override ViewModel EnrichModel(ViewModel sourceModel)
        {
            UgcComments model = base.EnrichModel(sourceModel) as UgcComments;
            if (model != null)
            {
                if (Request.HttpMethod == "POST")
                {
                    // don't retrieve comments on a POST and to keep rendering happy give it an
                    // empty list
                    model.Comments = new List<UgcComment>();
                }
                else
                {
                    var ugcService = new UgcService();
                    var comments = ugcService.GetComments(model.Target.PublicationId, model.Target.ItemId, false,
                        new int[] {}, 0, 0);
                    model.Comments = CreateEntities(comments);
                }

                return model;
            }
<commit_msg>TSI-3195 : Fixed issue with no comments during POST<commit_after>﻿using System.Collections.Generic;
using System.Linq;
using Sdl.Web.Mvc.Controllers;
using Sdl.Web.Common.Models;
using Sdl.Web.Modules.Ugc.Data;
using Sdl.Web.Modules.Ugc.Models;
using Sdl.Web.Mvc.Configuration;

namespace Sdl.Web.Modules.Ugc.Controllers
{
    /// <summary>
    /// Ugc Controller
    /// </summary>
    public class UgcController : EntityController
    {
        protected override ViewModel EnrichModel(ViewModel sourceModel)
        {
            UgcComments model = base.EnrichModel(sourceModel) as UgcComments;
            if (model != null)
            {
                var ugcService = new UgcService();
                var comments = ugcService.GetComments(model.Target.PublicationId, model.Target.ItemId, false,
                    new int[] {}, 0, 0);
                model.Comments = CreateEntities(comments);
                return model;
            }

{'fraction_non_alphanumeric': 0.09633649932157395, 'fraction_numerical': 0.003618272274988693, 'mean_word_length': 1.8431876606683804, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5516209', 'n_tokens_mistral': 621, 'n_tokens_neox': 597, 'n_words': 138}