public ActionResult Index(CountingModel model) { model.RoleName = Environment.GetEnvironmentVariable("WEBSITE_SITE_NAME"); string instanceId = Environment.GetEnvironmentVariable("WEBSITE_INSTANCE_ID")?.Substring(0, 6).ToUpper(); if (string.IsNullOrEmpty(model.RoleName)) { model.RoleName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name; } if (string.IsNullOrEmpty(instanceId)) { instanceId = Environment.MachineName; } model.CurrentInstance = instanceId; ViewBag.Message = $"[{model.RoleName}] [{instanceId}] Your application description page."; if (model.IncrementValue == 0) { model.CounterValue = _sharedContext.GetCounter(); } else { model.CounterValue = _sharedContext.UpdateCounter(model.IncrementValue); } return(View(model)); }
public PageCounting() { InitializeComponent(); if (!this.IsDesignMode()) { DataContext = new CountingModel(); } }