コード例 #1
0
        public async Task <BaseResult> CreateOrUpdate(DiscountModel model, int updateBy = 0, string updateByUserName = "")
        {
            var discount = model.ToDiscount();

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

            if (discount.Id > 0)
            {
                //Cập nhật
                return(await Update(discount));
            }
            else
            {
                //Thêm mới
                return(await Create(discount));
            }
        }