Exemple #1
0
 public MetricsViewModel(MetricsBase metrics, CheckAvailabilityModel checkAvailability = null)
 {
     this.Project           = metrics.Project;
     this.ProjectList       = metrics.ProjectList;
     this.CheckAvailability = checkAvailability;
     this.FirstPostDate     = metrics.FirstPostDate.HasValue ? metrics.FirstPostDate.Value.ToString(string.Empty) : "<неизвестно>";
 }
        public JsonResult CheckAvailability(int id)
        {
            var result            = this.metricsService.CheckAvailability(id);
            var checkAvailability = new CheckAvailabilityModel
            {
                IsReady = (bool)result[2],
                Done    = (int)result[0],
                Total   = (int)result[1]
            };

            return(this.Json(checkAvailability));
        }
        public override ActionResult Index(int id)
        {
            MetricsBase metrics           = this.metricsService.GetBaseMetrics(id);
            var         result            = this.metricsService.CheckAvailability(id);
            var         checkAvailability = new CheckAvailabilityModel
            {
                IsReady = (bool)result[2],
                Done    = (int)result[0],
                Total   = (int)result[1]
            };
            var viewModel = new MetricsViewModel(metrics, checkAvailability);

            return(this.MetricsView("Dashboard", viewModel));
        }