Exemplo n.º 1
0
        public InvoiceItem GetInvoiceItemById(int id)
        {
            var obj = _invoiceItemRepository.Get(c => c.Id == id);

            //var obj = _vendorRepository.GetAll().Where(p=>p.Id==id).FirstOrDefault();
            //var obj = _vendorRepository.GetById(id);
            //var obj = _vendorRepository.GetMany(p => p.Id == id).FirstOrDefault();
            return(obj);
        }
        public ActionResult RemoveItem(Guid id, Guid invoiceId)
        {
            var item    = _invoiceItemRepository.Get(id);
            var invoice = _invoiceRepository.GetWithItems(GetCurrentUserId(), invoiceId);

            invoice.NoVatPrice -= item.TotalNoVatPrice;
            var fullprice = _vatCalculator.CalculateFullPrice(invoice.NoVatPrice, invoice.Vat);

            invoice.FullPrice = fullprice;

            _invoiceRepository.Update(GetCurrentUserId(), invoice);

            _invoiceItemRepository.Remove(GetCurrentUserId(), id);

            return(RedirectToAction("Items", new { id = invoiceId }));
        }