Beispiel #1
0
        public async Task <int> Delete(Tbl_orderRequest tbl_orderRequest)
        {
            var tbl_order = new tbl_order()
            {
                id = tbl_orderRequest.id
            };

            _context.tbl_orders.Remove(tbl_order);

            return(await _context.SaveChangesAsync());
        }
        public async Task <string> Update(Tbl_orderRequest request)
        {
            var json        = JsonConvert.SerializeObject(request);
            var httpContent = new StringContent(json, Encoding.UTF8, "application/json");

            var client = _httpClientFactory.CreateClient();

            client.BaseAddress = new Uri("https://localhost:44358");
            var response = await client.PostAsync("api/Tbl_order/Update", httpContent);

            return(await response.Content.ReadAsStringAsync());
        }
Beispiel #3
0
        public async Task <int> Create(Tbl_orderRequest tbl_orderRequest)
        {
            var tbl_order = new tbl_order()
            {
                fee      = tbl_orderRequest.fee,
                discount = tbl_orderRequest.discount,
                total    = tbl_orderRequest.total
            };

            _context.tbl_orders.Add(tbl_order);

            return(await _context.SaveChangesAsync());
        }
Beispiel #4
0
        public async Task <int> Update(Tbl_orderRequest tbl_orderRequest)
        {
            int maxId     = _context.tbl_orders.Max(u => u.id);
            var tbl_order = new tbl_order()
            {
                id       = maxId,
                fee      = tbl_orderRequest.fee,
                discount = tbl_orderRequest.discount,
                total    = tbl_orderRequest.total
            };

            _context.tbl_orders.Update(tbl_order);

            return(await _context.SaveChangesAsync());
        }
Beispiel #5
0
 public async Task <IActionResult> Delete([FromBody] Tbl_orderRequest request)
 {
     return(Ok(await _nhanSuSerive.Delete(request)));
 }