public bool ConfirmPayment(int id)
 {
     try
     {
         var invoice = _repo.Get(id);
         invoice.PaymentStatus      = (int)PaymentStatus.Confirmed;
         invoice.PaymentConfirmDate = DateTime.Now;
         _repo.Update(invoice);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Invoice invoice = _repo.Get(id.Value);

            if (invoice == null)
            {
                return(HttpNotFound());
            }
            ViewBag.GeoDivisionId = new SelectList(_GeoRepo.GetGeoDivisionsByType((int)GeoDivisionType.State), "Id", "Title", invoice.GeoDivisionId);
            return(View(invoice));
        }
        public async Task GetById_WhenNotPresent_ReturnsNull(Func <string, InvoicingContext> factory)
        {
            //Arrange
            using (var context = factory(nameof(GetById_WhenNotPresent_ReturnsNull)))
            {
                var sut = new InvoicesRepository(context);

                //Act
                var invoice = await sut.Get(100);

                //Assert
                invoice.Should().BeNull();
            }
        }
        public async Task GetById_WhenExists_ReturnsInvoice(Func <string, InvoicingContext> factory)
        {
            //Arrange
            using (var context = factory(nameof(GetById_WhenExists_ReturnsInvoice)))
            {
                var invoiceId = 1;
                var sut       = new InvoicesRepository(context);

                //Act
                var invoice = await sut.Get(invoiceId);

                //Assert
                invoice.Should().NotBeNull();
                invoice.InvoiceId.Should().Be(invoiceId);
            }
        }