//Create Coupon public static int Create(CouponDTO CouponDTO) { try { var Coupon = new Coupon(); UnitOfWork uow = new UnitOfWork(); Coupon = Transform.CouponToDomain(CouponDTO); uow.CouponRepo.Insert(Coupon); uow.SaveChanges(); CouponDTO.Id = Coupon.Id; return CouponDTO.Id; } catch (Exception) { throw; } }
public static CouponDTO CouponToDTO(Coupon Coupon) { if (Coupon == null) return null; Mapper.CreateMap<Coupon, CouponDTO>(); CouponDTO CouponDTO = Mapper.Map<CouponDTO>(Coupon); return CouponDTO; }