public async Task <int> DeleteProductFromSellBill(UpdateProductInBillRequest request) { var sellBill = await _context.ProductInSellBills.FindAsync(request.SellBillId, request.ProductId); _context.ProductInSellBills.Remove(sellBill); return(await _context.SaveChangesAsync()); }
public async Task <IActionResult> DeleteProductFromSellBill([FromForm] UpdateProductInBillRequest request) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var productInSellBill = await _sellService.DeleteProductFromSellBill(request); return(Ok(productInSellBill)); }
public async Task <int> AddProductIntoSellBill(UpdateProductInBillRequest request) { var SellBillCompleted = new ProductInSellBill() { ProductId = request.ProductId, SellBillId = request.SellBillId }; _context.ProductInSellBills.Add(SellBillCompleted); return(await _context.SaveChangesAsync()); }