public async Task <string> AddWidget(string widgetName) { if (string.IsNullOrEmpty(widgetName)) { throw new ArgumentException("name is required"); } await _widgetService.AddWidget(widgetName); return("OK"); }
public JsonResult Add_POST([IoCModelBinder(typeof(AddWidgetModelBinder))] Widget widget) { _widgetService.AddWidget(widget); return(Json(widget.Id)); }
private void SetupProductLayoutWidgets(LayoutModel layoutModel, PageModel pageModel) { var breadcrumbs = new BreadCrumb { LayoutArea = layoutModel.ProductLayout.LayoutAreas.First(x => x.AreaName == "Before Product Content"), Name = "Breadcrumbs", IsRecursive = true, Cache = true, CacheExpiryType = CacheExpiryType.Sliding, CacheLength = 180 }; _widgetService.AddWidget(breadcrumbs); var relatedProducts = new RelatedProducts { LayoutArea = layoutModel.ProductLayout.LayoutAreas.First(x => x.AreaName == "After Product Content"), Name = "Related Products", Cache = true, CacheExpiryType = CacheExpiryType.Absolute, CacheLength = 1800 }; _widgetService.AddWidget(relatedProducts); var peopleAlsoBought = new PeopleWhoBoughtThisAlsoBought { LayoutArea = layoutModel.ProductLayout.LayoutAreas.First(x => x.AreaName == "After Product Content"), Name = "People who bought this also bought", Cache = true, CacheExpiryType = CacheExpiryType.Absolute, CacheLength = 1800 }; _widgetService.AddWidget(peopleAlsoBought); var otherCategories = new NotWhatYouWereLookingForWidget { LayoutArea = layoutModel.ProductLayout.LayoutAreas.First(x => x.AreaName == "Below Product Price"), Name = "Not what you were looking for?", Cache = true, CacheExpiryType = CacheExpiryType.Absolute, CacheLength = 1800 }; _widgetService.AddWidget(otherCategories); }