<commit_before>﻿namespace Kcsara.Database.Web.Controllers
{
  using System;
  using System.Configuration;
  using System.IO;
  using System.Linq;
  using System.Text;
  using System.Web.Mvc;
  using System.Xml;
  using Kcsar.Database;
  using Kcsar.Database.Model;
  using Kcsara.Database.Web.Services;
  using Kcsara.Database.Web.Model;
  using Sar.Database.Api.Extensions;

  /// <summary>Views related to SAR units.</summary>
  public class UnitsController : BaseController
  {
    private readonly IReportsService reports;
    private readonly Lazy<IExtensionProvider> extensions;

    public UnitsController(Lazy<IExtensionProvider> extensions, IReportsService reports, IKcsarContext db, IAppSettings settings) : base(db, settings)
    {
      this.reports = reports;
      this.extensions = extensions;
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="id">unit id</param>
    /// <returns></returns>
    [AuthorizeWithLog]
    public ActionResult Applicants(Guid id)
    {
      var unit = this.db.Units.Single(f => f.Id == id);
      //var model = this.db.UnitApplicants.Include("Applicant").Where(f => f.Unit.Id == id).OrderBy(f => f.IsActive).ThenBy(f => f.Applicant.LastName).ThenBy(f => f.Applicant.FirstName).AsEnumerable();

      //ViewBag.Unit = unit;
      return View(unit);
    }

    public DataActionResult GetMemberEmails(string id)
    {
      if (!Permissions.IsUser) return GetLoginError();

      return Data(UnitsController.GetMemberEmails(this.db, id));
    }

    public static MemberDetailView[] GetMemberEmails(IKcsarContext ctx, string id)
    {
      Guid unitId = UnitsController.ResolveUnit(ctx.Units, id).Id;<commit_msg>restore unit status API for members status popup<commit_after>﻿namespace Kcsara.Database.Web.Controllers
{
  using System;
  using System.Configuration;
  using System.IO;
  using System.Linq;
  using System.Text;
  using System.Web.Mvc;
  using System.Xml;
  using Kcsar.Database;
  using Kcsar.Database.Model;
  using Kcsara.Database.Web.Services;
  using Kcsara.Database.Web.Model;
  using Sar.Database.Api.Extensions;

  /// <summary>Views related to SAR units.</summary>
  public class UnitsController : BaseController
  {
    private readonly IReportsService reports;
    private readonly Lazy<IExtensionProvider> extensions;

    public UnitsController(Lazy<IExtensionProvider> extensions, IReportsService reports, IKcsarContext db, IAppSettings settings) : base(db, settings)
    {
      this.reports = reports;
      this.extensions = extensions;
    }

    [Authorize]
    public DataActionResult GetStatusTypes(Guid id)
    {
      var result = (from s in this.db.UnitStatusTypes where s.Unit.Id == id orderby s.StatusName select new NameIdViewModel { Name = s.StatusName, Id = s.Id });

      return Data(result);
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="id">unit id</param>
    /// <returns></returns>
    [AuthorizeWithLog]
    public ActionResult Applicants(Guid id)
    {
      var unit = this.db.Units.Single(f => f.Id == id);
      //var model = this.db.UnitApplicants.Include("Applicant").Where(f => f.Unit.Id == id).OrderBy(f => f.IsActive).ThenBy(f => f.Applicant.LastName).ThenBy(f => f.Applicant.FirstName).AsEnumerable();

      //ViewBag.Unit = unit;
      return View(unit);
    }

    public DataActionResult GetMemberEmails(string id)
    {
      if (!Permissions.IsUser) return GetLoginError();

      return Data(UnitsController.GetMemberEmails(this.db, id));
    }

    public static MemberDetailView[] GetMemberEmails(IKcsarContext ctx, string id)
    {
      Guid unitId = UnitsController.ResolveUnit(ctx.Units, id).Id;
{'fraction_non_alphanumeric': 0.1208731241473397, 'fraction_numerical': 0.0, 'mean_word_length': 3.353919239904988, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 33, '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': '5889324', 'n_tokens_mistral': 1147, 'n_tokens_neox': 1125, 'n_words': 247}