<commit_before>
using System.Collections.Generic;

namespace project.Services
{
    public class CartServices : ICartServices
    {
        private readonly CartRespository cartRespository;
        private readonly ProductRepository productRepository;
        private readonly OrderProductRespository orderProductRespository;
        public CartServices()
        {
            cartRespository = new CartRespository();
            productRepository = new ProductRepository();
            orderProductRespository = new OrderProductRespository();
        }
        public int addOrder(Cart order)
        {
            // insert order to database
            var orderCode = cartRespository.Add(order);
            // insert to OrderProduct
            // get list product by ids
           foreach(var product in order.products){
               // get product information 
               var p = productRepository.GetByID(product.productId);
               // insert order
               var newOrderProduct = new Entities.OrderProduct();
               newOrderProduct.netPrice = p.netPrice;
               newOrderProduct.price = p.Price;
               newOrderProduct.number = product.number;
               newOrderProduct.orderCode = orderCode;
               newOrderProduct.productId = p.ProductId;
               newOrderProduct.productCode = p.code;
               // insert mapping
               orderProductRespository.Add(newOrderProduct);
           }
            return orderCode;

        }

        public void deleteOrder(int orderId)
        {<commit_msg>change the way caculate price for order item<commit_after>
using System.Collections.Generic;

namespace project.Services
{
    public class CartServices : ICartServices
    {
        private readonly CartRespository cartRespository;
        private readonly ProductRepository productRepository;
        private readonly OrderProductRespository orderProductRespository;
        public CartServices()
        {
            cartRespository = new CartRespository();
            productRepository = new ProductRepository();
            orderProductRespository = new OrderProductRespository();
        }
        public int addOrder(Cart order)
        {
            // insert order to database
            var orderCode = cartRespository.Add(order);
            // insert to OrderProduct
            // get list product by ids
           foreach(var product in order.products){
               // get product information 
               var p = productRepository.GetByID(product.productId);
               // insert order
               var newOrderProduct = new Entities.OrderProduct();
               newOrderProduct.netPrice = p.netPrice * product.number;
               newOrderProduct.price = p.Price *product.number;
               newOrderProduct.number = product.number;
               newOrderProduct.orderCode = orderCode;
               newOrderProduct.productId = p.ProductId;
               newOrderProduct.productCode = p.code;
               // insert mapping
               orderProductRespository.Add(newOrderProduct);
           }
            return orderCode;

        }

        public void deleteOrder(int orderId)
        {
{'fraction_non_alphanumeric': 0.06164383561643835, 'fraction_numerical': 0.0, 'mean_word_length': 1.9182561307901906, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4651651', 'n_tokens_mistral': 700, 'n_tokens_neox': 713, 'n_words': 185}