/// <summary> /// Inserts product layout /// </summary> /// <param name="productLayout">Product layout</param> public virtual async Task InsertProductLayout(ProductLayout productLayout) { if (productLayout == null) { throw new ArgumentNullException(nameof(productLayout)); } await _productLayoutRepository.InsertAsync(productLayout); //clear cache await _cacheBase.RemoveByPrefix(CacheKey.PRODUCT_LAYOUT_PATTERN_KEY); //event notification await _mediator.EntityInserted(productLayout); }
public async Task <IActionResult> ProductLayoutAdd(ProductLayoutModel model) { if (!ModelState.IsValid) { return(Json(new DataSourceResult { Errors = ModelState.SerializeErrors() })); } if (ModelState.IsValid) { var layout = new ProductLayout(); layout = model.ToEntity(layout); await _productLayoutService.InsertProductLayout(layout); return(new JsonResult("")); } return(ErrorForKendoGridJson(ModelState)); }
public static ProductLayoutModel ToModel(this ProductLayout entity) { return(entity.MapTo <ProductLayout, ProductLayoutModel>()); }
public static ProductLayout ToEntity(this ProductLayoutModel model, ProductLayout destination) { return(model.MapTo(destination)); }