示例#1
0
        private PostHistoryDTO ToDTO(PostHistoryEntity postHistoryEntity)
        {
            PostHistoryDTO postHistoryDTO = new PostHistoryDTO()
            {
                ApproveStateId = postHistoryEntity.ApproveStateId,
                Bank           = postHistoryEntity.Bank,
                Id             = postHistoryEntity.Id,
                Money          = postHistoryEntity.Money,
                PostDesc       = postHistoryEntity.PostDesc,
                UserId         = postHistoryEntity.UserId
            };

            return(postHistoryDTO);
        }
示例#2
0
 public long InsertPostHistory(PostHistoryDTO t_PostHistory)
 {
     using (B2CDbContext ctx = new B2CDbContext())
     {
         PostHistoryEntity postHistoryEntity = new PostHistoryEntity()
         {
             ApproveStateId = t_PostHistory.ApproveStateId,
             Bank           = t_PostHistory.Bank,
             Money          = t_PostHistory.Money,
             PostDesc       = t_PostHistory.PostDesc,
             UserId         = t_PostHistory.UserId
         };
         ctx.PostHistories.Add(postHistoryEntity);
         ctx.SaveChanges();
         return(postHistoryEntity.Id);
     }
 }
示例#3
0
 public long UpdatePostHistory(PostHistoryDTO t_PostHistory)
 {
     using (B2CDbContext ctx = new B2CDbContext())
     {
         BaseService <PostHistoryEntity> bs = new BaseService <PostHistoryEntity>(ctx);
         if (bs.GetAll().Any(e => e.Id == t_PostHistory.Id))
         {
             return(0);
         }
         else
         {
             var postHistoryEntity = bs.GetById(t_PostHistory.Id);
             postHistoryEntity.PostDesc       = t_PostHistory.PostDesc;
             postHistoryEntity.ApproveStateId = t_PostHistory.ApproveStateId;
             postHistoryEntity.UserId         = t_PostHistory.UserId;
             postHistoryEntity.Bank           = t_PostHistory.Bank;
             postHistoryEntity.Money          = t_PostHistory.Money;
             ctx.SaveChanges();
             return(postHistoryEntity.Id);
         }
     }
 }