Exemple #1
0
        public async Task <int> Delete(Tbl_itemRequest tbl_itemRequest)
        {
            var tbl_item = new tbl_item()
            {
                id = tbl_itemRequest.id
            };

            _context.tbl_items.Remove(tbl_item);

            return(await _context.SaveChangesAsync());
        }
Exemple #2
0
        public async Task <int> Update(Tbl_itemRequest tbl_itemRequest)
        {
            var tbl_item = new tbl_item()
            {
                id        = tbl_itemRequest.id,
                idproduct = tbl_itemRequest.idproduct,
                discount  = tbl_itemRequest.discount,
                quanlity  = tbl_itemRequest.quanlity,
                price     = tbl_itemRequest.price,
                idorder   = tbl_itemRequest.idorder
            };

            _context.tbl_items.Update(tbl_item);

            return(await _context.SaveChangesAsync());
        }
Exemple #3
0
        public async Task <int> Create(Tbl_itemRequest tbl_itemRequest)
        {
            int maxId    = _context.tbl_orders.Max(u => u.id);
            var tbl_item = new tbl_item()
            {
                idproduct = tbl_itemRequest.idproduct,
                discount  = tbl_itemRequest.discount,
                quanlity  = tbl_itemRequest.quanlity,
                price     = tbl_itemRequest.price,
                idorder   = maxId
            };

            _context.tbl_items.Add(tbl_item);

            return(await _context.SaveChangesAsync());
        }