C# Class CardShop.Service.DiscountService

DiscountService class will handle all service type requests
Inheritance: IDiscountService
Show file Open project: egreene/PracticeGDVP Class Usage Examples

Public Methods

Method Description
CreateCoupon ( UserDiscount coupon ) : UserDiscount

Create and submit coupon

DiscountService ( ) : System

No-Args constructor, creates new CouponUtility();

GetAllUsers ( ) : List

GetAllUsers gets a list of all the Users

GetCoupon ( int userId, String discountCode, bool &isSuccess, String &error ) : UserDiscount

Get Coupon by userId and discountCode returns null if no UserDiscount is found Using outs to return additional error information Also checks for expiration and redemption status

GetCouponList ( UserDiscount coupon ) : List

Returns a matching UserDiscount from the database

GetInstance ( ) : IDiscountService
RedeemCoupon ( UserDiscount coupon, bool &isSuccess ) : UserDiscount

Mark Inputted coupon as redeemed.

ValidateCoupon ( List couponList, bool &isSuccess, String &error ) : UserDiscount

Checks coupon to see if it is valid

getCouponListByUserIdAndCouponCode ( int userId, String discountCode ) : List

Method Details

CreateCoupon() public method

Create and submit coupon
public CreateCoupon ( UserDiscount coupon ) : UserDiscount
coupon CardShop.Models.UserDiscount Coupon without code
return CardShop.Models.UserDiscount

DiscountService() public method

No-Args constructor, creates new CouponUtility();
public DiscountService ( ) : System
return System

GetAllUsers() public method

GetAllUsers gets a list of all the Users
public GetAllUsers ( ) : List
return List

GetCoupon() public method

Get Coupon by userId and discountCode returns null if no UserDiscount is found Using outs to return additional error information Also checks for expiration and redemption status
public GetCoupon ( int userId, String discountCode, bool &isSuccess, String &error ) : UserDiscount
userId int
discountCode String
isSuccess bool
error String
return CardShop.Models.UserDiscount

GetCouponList() public method

Returns a matching UserDiscount from the database
public GetCouponList ( UserDiscount coupon ) : List
coupon CardShop.Models.UserDiscount
return List

GetInstance() public static method

public static GetInstance ( ) : IDiscountService
return IDiscountService

RedeemCoupon() public method

Mark Inputted coupon as redeemed.
public RedeemCoupon ( UserDiscount coupon, bool &isSuccess ) : UserDiscount
coupon CardShop.Models.UserDiscount
isSuccess bool
return CardShop.Models.UserDiscount

ValidateCoupon() public method

Checks coupon to see if it is valid
public ValidateCoupon ( List couponList, bool &isSuccess, String &error ) : UserDiscount
couponList List
isSuccess bool
error String
return CardShop.Models.UserDiscount

getCouponListByUserIdAndCouponCode() public method

public getCouponListByUserIdAndCouponCode ( int userId, String discountCode ) : List
userId int
discountCode String
return List