public ActionResult Index(WidgetPage currentPage) { var model = new WidgetPageViewModel(currentPage); PageViewModel.SetOtherLanguage(model, currentPage); var widgetId = Request["WidgetId"]; var(language, id) = GetId(widgetId); if (string.IsNullOrEmpty(language) || id < 0) { return(View(model)); } model.Widget = _widgetRepository.GetWidget(id); switch (language) { case "en": model.WidgetDescription = model.Widget.WidgetDescriptionEn; break; case "nl": model.WidgetDescription = model.Widget.WidgetDescriptionNl; break; } return(View(model)); }
public async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = ApiName + "/widgetId?")] HttpRequest req, string widgetId) { var result = await _widgetRepository.GetWidget(widgetId); return(new OkObjectResult(result)); }
public Widget GetWidget(Guid id) { return(_repo.GetWidget(id)); }