Beispiel #1
0
        public void PostProduct(ProductViewModel productViewModel)
        {
            Product ref_Product = new Product();

            ref_Product.Code      = productViewModel.Code;
            ref_Product.Title     = productViewModel.Title;
            ref_Product.UnitPrice = productViewModel.UnitPrice;
            ref_Product.Countity  = productViewModel.Countity;
            Ref_ProductRepository.Insert(ref_Product);
        }
Beispiel #2
0
        public ProductViewModel FindProducts(int?id)
        {
            var ref_product = Ref_ProductRepository.FindProduct(id);
            ProductViewModel ref_ProductViewModel = new ProductViewModel();

            ref_ProductViewModel.Id        = ref_product.Id;
            ref_ProductViewModel.Code      = ref_product.Code;
            ref_ProductViewModel.Title     = ref_product.Title;
            ref_ProductViewModel.UnitPrice = ref_product.UnitPrice;
            ref_ProductViewModel.Countity  = ref_product.Countity;
            return(ref_ProductViewModel);
        }
Beispiel #3
0
        public void PutProduct(ProductViewModel ref_productViewModel)
        {
            var ref_product = new Product();

            //ref_product.Id = (int)ref_productViewModel.Id;
            ref_product.Id        = ref_productViewModel.Id;
            ref_product.Code      = ref_productViewModel.Code;
            ref_product.Title     = ref_productViewModel.Title;
            ref_product.UnitPrice = ref_productViewModel.UnitPrice;
            ref_product.Countity  = ref_productViewModel.Countity;
            Ref_ProductRepository.Update(ref_product);
        }
Beispiel #4
0
        public List <DomainModels.DTO.EF.Product> GetProduct()
        {
            var products = Ref_ProductRepository.Select();

            return(products);
        }
Beispiel #5
0
        public void DeleteProduct(ProductViewModel ref_productViewModel)
        {
            var id = ref_productViewModel.Id;

            Ref_ProductRepository.Delete(id);
        }