Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
 public Widget GetWidget(Guid id)
 {
     return(_repo.GetWidget(id));
 }