Esempio n. 1
0
        public ProductViewModels.ProductSingleResult GetById(ProductViewModels.GetByIdRequest request)
        {
            var data = _dbRepository.GetAll <Product>()
                       .FirstOrDefault(x => x.ProductId == request.ProductId);

            var result = new ProductViewModels.ProductSingleResult()
            {
                ProductId    = data.ProductId,
                ProductName  = data.ProductName,
                UnitPrice    = data.UnitPrice,
                Isbn         = data.Isbn,
                SupplierId   = data.SupplierId,
                Author       = data.Author,
                Inventory    = data.Inventory,
                CategoryId   = data.CategoryId,
                PublishDate  = data.PublishDate,
                Sort         = data.Sort,
                CreateTime   = data.CreateTime,
                UpdateTime   = data.UpdateTime,
                Introduction = data.Introduction,
                TotalSales   = data.TotalSales,
                //IsFav = data.IsFav,
                IsSpecial = data.IsSpecial
            };

            return(result);
        }
Esempio n. 2
0
        public bool DeleteItem(ProductViewModels.GetByIdRequest request)
        {
            bool isSuccess = _productService.Remove(request.ProductId);

            return(isSuccess);
        }