Ejemplo n.º 1
0
 public static ProductGroupProductAddCommand ToCommandProductAdd(this ProductGroupProductAddRequest request, string uid)
 {
     if (request == null)
     {
         return(null);
     }
     return(new ProductGroupProductAddCommand()
     {
         ProductGroupId = request.ProductGroupId,
         UpdatedUid = uid,
         ProductId = request.ProductId
     });
 }
Ejemplo n.º 2
0
 public async Task <IActionResult> AddProduct([FromBody] ProductGroupProductAddRequest request)
 {
     try
     {
         BaseResponse     response = new BaseResponse();
         ValidationResult validate = ProductGroupProductAddRequestValidator.ValidateModel(request);
         if (validate.IsValid)
         {
             response = await _productGroupAppService.AddProduct(request);
         }
         else
         {
             response.SetFail(validate.Errors.Select(p => p.ToString()));
         }
         return(Json(response));
     }
     catch (Exception e)
     {
         _logger.LogError(e, Common.Common.GetMethodName(), request);
         throw;
     }
 }