private ShopHistoryDTO ToDTO(ShopHistoryEntity shopHistoryEntity) { ShopHistoryDTO shopHistoryDTO = new ShopHistoryDTO() { CardId = shopHistoryEntity.CardId, Id = shopHistoryEntity.Id, UserId = shopHistoryEntity.UserId, UserName = shopHistoryEntity.User.UserName }; return(shopHistoryDTO); }
public long InsertShopHistory(ShopHistoryDTO t_ShopHistory) { using (B2CDbContext ctx = new B2CDbContext()) { ShopHistoryEntity shopHistoryEntity = new ShopHistoryEntity() { CardId = t_ShopHistory.CardId, UserId = t_ShopHistory.UserId }; ctx.ShopHistories.Add(shopHistoryEntity); ctx.SaveChanges(); return(shopHistoryEntity.Id); } }