Esempio n. 1
0
        public NvChuongTrinhKhuyenMai InsertPhieu(NvKhuyenMaiVoucherVm.Dto instance)
        {
            var item = AutoMapper.Mapper.Map <NvKhuyenMaiVoucherVm.Dto, NvChuongTrinhKhuyenMai>(instance);

            item.Id              = Guid.NewGuid().ToString();
            item.MaChuongTrinh   = SaveCode();
            item.TrangThaiSuDung = (int)ApprovalState.IsComplete;
            var result = Insert(item);

            return(result);
        }
Esempio n. 2
0
        public NvChuongTrinhKhuyenMai UpdatePhieu(NvKhuyenMaiVoucherVm.Dto instance)
        {
            var exsitItem = FindById(instance.Id);

            if (exsitItem.TrangThai == (int)ApprovalState.IsComplete)
            {
                return(null);
            }
            var masterData = Mapper.Map <NvKhuyenMaiVoucherVm.Dto, NvChuongTrinhKhuyenMai>(instance);

            var result = Update(masterData);

            return(result);
        }