Exemple #1
0
        private CardStateDTO ToDTO(CardStateEntity cardStateEntity)
        {
            CardStateDTO cardStateDTO = new CardStateDTO()
            {
                CardState     = cardStateEntity.CardState,
                CardStateName = cardStateEntity.CardStateName,
                Id            = cardStateEntity.Id
            };

            return(cardStateDTO);
        }
Exemple #2
0
 public long InsertCardState(CardStateDTO t_CardState)
 {
     using (B2CDbContext ctx = new B2CDbContext())
     {
         CardStateEntity cardStateEntity = new CardStateEntity()
         {
             CardState     = t_CardState.CardState,
             CardStateName = t_CardState.CardStateName
         };
         ctx.CardState.Add(cardStateEntity);
         ctx.SaveChanges();
         return(cardStateEntity.Id);
     }
 }
Exemple #3
0
 public CardStateDTO SelectCardStateByID(long t_cardStateId)
 {
     using (B2CDbContext ctx = new B2CDbContext())
     {
         BaseService <CardStateEntity> bs = new BaseService <CardStateEntity>(ctx);
         var          cardState           = bs.GetById(t_cardStateId);
         CardStateDTO cardStateDTO        = new CardStateDTO()
         {
             CardState     = cardState.CardState,
             CardStateName = cardState.CardStateName,
             Id            = cardState.Id
         };
         return(cardStateDTO);
     }
 }
Exemple #4
0
 public long UpdateCardState(CardStateDTO t_CardState)
 {
     using (B2CDbContext ctx = new B2CDbContext())
     {
         if (ctx.Card.Any(e => e.Id == t_CardState.Id))
         {
             BaseService <CardStateEntity> bs = new BaseService <CardStateEntity>(ctx);
             var cardState = bs.GetById(t_CardState.Id);
             cardState.CardState     = t_CardState.CardState;
             cardState.CardStateName = t_CardState.CardStateName;
             ctx.SaveChanges();
             return(cardState.Id);
         }
         else
         {
             return(0);
         }
     }
 }