Пример #1
0
        public async Task <BaseResult> CreateOrUpdate(DiscountOrderModel model, int updateBy = 0, string updateByUserName = "")
        {
            var discountOrder = model.ToDiscountOrder();

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

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

            return(Ok(result));
        }
Пример #3
0
 public static DiscountOrder ToDiscountOrder(this DiscountOrderModel model)
 {
     return(model.MapTo <DiscountOrderModel, DiscountOrder>());
 }