public async Task <BaseResult> CreateOrUpdate(CampaignProductModel model, int updateBy = 0, string updateByUserName = "")
        {
            var campaignProduct = model.ToCampaignProduct();

            //Cập nhật thông tin chung của thực thể
            campaignProduct = campaignProduct.UpdateCommonInt(updateBy, updateByUserName);

            if (campaignProduct.Id > 0)
            {
                //Cập nhật
                return(await Update(campaignProduct));
            }
            else
            {
                //Thêm mới
                return(await Create(campaignProduct));
            }
        }
        public async Task <IActionResult> CreateOrUpdate([FromBody] CampaignProductModel campaignProduct)
        {
            var result = await _campaignProductService.CreateOrUpdate(campaignProduct);

            return(Ok(result));
        }
Ejemplo n.º 3
0
 public static CampaignProduct ToCampaignProduct(this CampaignProductModel model)
 {
     return(model.MapTo <CampaignProductModel, CampaignProduct>());
 }