Exemplo n.º 1
0
        public Response <List <CustomerCardDetails> > ViewCustomerCard(CustomerCardDetails model, string UserId)
        {
            Response <List <CustomerCardDetails> > returnModel = new Response <List <CustomerCardDetails> >();

            try
            {
                using (SqlConnection DB = new SqlConnection(SiteKey.ConnectionString))
                {
                    returnModel.result = DB.QuerySql <CustomerCardDetails>("Select * from customer_payment_card where user_id = @user_id ", new
                    {
                        user_id = UserId
                    }).ToList();
                    returnModel.status  = (int)EnumClass.ResponseState.Success;
                    returnModel.msg     = "Card List";
                    returnModel.success = true;
                }

                return(returnModel);
            }
            catch (Exception ex)
            {
                returnModel.msg    = ex.Message;
                returnModel.status = (int)EnumClass.ResponseState.ResposityError;
                LoggingRepository.SaveException(ex);
                returnModel.success = false;
                return(returnModel);
            }
        }
Exemplo n.º 2
0
        public Response <CustomerCardDetails> DeleteCustomerCard(CustomerCardDetails model)
        {
            Response <CustomerCardDetails> returnModel = new Response <CustomerCardDetails>();

            try
            {
                using (SqlConnection DB = new SqlConnection(SiteKey.ConnectionString))
                {
                    DB.ExecuteSql("delete from customer_payment_card where id = @id",
                                  new
                                  { id = model.id });



                    returnModel.msg     = "Card Delete Successfully!.";
                    returnModel.status  = (int)EnumClass.ResponseState.Success;
                    returnModel.success = false;
                    return(returnModel);
                }
            }
            catch (Exception ex)
            {
                returnModel.msg     = ex.Message;
                returnModel.status  = (int)EnumClass.ResponseState.Failure;
                returnModel.success = false;
                return(returnModel);
            }
        }
Exemplo n.º 3
0
        public Response <CustomerCardDetails> InsertCustomerCard(CustomerCardDetails model, string UserId)
        {
            Response <CustomerCardDetails> returnModel = new Response <CustomerCardDetails>();

            try
            {
                using (SqlConnection DB = new SqlConnection(SiteKey.ConnectionString))
                {
                    DB.ExecuteSql("insert into customer_payment_card values(@id,@user_id,@expiry_month,@card_last_digit,@status,@created,@modified,@expiry_year,@card_ref_number) ",

                                  new
                    {
                        id              = Guid.NewGuid().ToString(),
                        user_id         = UserId,
                        expiry_month    = model.expiry_month,
                        card_last_digit = model.card_last_digit,
                        status          = 1,
                        created         = DateTime.Now,
                        modified        = DateTime.Now,
                        expiry_year     = model.expiry_year,
                        card_ref_number = model.card_ref_number
                    });



                    returnModel.msg     = "Card Added Successfully!.";
                    returnModel.status  = (int)EnumClass.ResponseState.Success;
                    returnModel.success = false;
                    return(returnModel);
                }
            }
            catch (Exception ex)
            {
                returnModel.msg     = ex.Message;
                returnModel.status  = (int)EnumClass.ResponseState.Failure;
                returnModel.success = false;
                return(returnModel);
            }
        }
Exemplo n.º 4
0
        public ActionResult DeleteCustomerCard([FromBody] CustomerCardDetails Model)
        {
            Response <CustomerCardDetails> Result = new UserRepository().DeleteCustomerCard(Model);

            return(Ok(Result));
        }
Exemplo n.º 5
0
        public ActionResult ViewCustomerCard(CustomerCardDetails Model)
        {
            Response <List <CustomerCardDetails> > Result = new UserRepository().ViewCustomerCard(Model, GetUserId());

            return(Ok(Result));
        }
Exemplo n.º 6
0
 public ActionResult CustomerCardInsert([FromBody] CustomerCardDetails Model)
 {
     return(Ok());
 }
Exemplo n.º 7
0
        public ActionResult InsertCustomerCard([FromBody] CustomerCardDetails Model)
        {
            Response <CustomerCardDetails> Result = new UserRepository().InsertCustomerCard(Model, GetUserId());

            return(Ok(Result));
        }