Example #1
0
        public void AddInvoiceDetail(Product product, float quantity, float discount)
        {
            invoice.AgregarDetalleFactura(product, quantity, discount);
            InvoiceDetailDTO invoiceDTO = invoiceService.MapInvoiceDetailDTO(product, quantity, discount);

            invoiceDetailDTOs.Add(invoiceDTO);
        }
        public IHttpActionResult CreateInvoiceDetail(InvoiceDetailDTO invoiceDetailDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            _invoiceDetailLogic.Create(invoiceDetailDto);
            return(Created(new Uri(Request.RequestUri + "/" + invoiceDetailDto.Id), invoiceDetailDto));
        }
 public ActionResult Create(InvoiceDetailDTO invoiceDetail)
 {
     try
     {
         if (!invoiceDetail.Invoice.InvoiceStatus.Equals(StatusDTO.Completed))
         {
             mgr.AddInvoiceDetail(invoiceDetail);
         }
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
        public IHttpActionResult UpdateInvoiceDetail(InvoiceDetailDTO invoiceDetailDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var invoiceDetailInDb = _invoiceDetailLogic.FindByID(invoiceDetailDto.Id);

            if (invoiceDetailInDb == null)
            {
                return(NotFound());
            }

            return(Ok(_invoiceDetailLogic.Update(invoiceDetailDto)));
        }
Example #5
0
 public void ChangeInvoiceDetail(InvoiceDetailDTO invoiceDetail)
 {
     repo.UpdateInvoiceDetail(MapDTO.Map <InvoiceDetail, InvoiceDetailDTO>(invoiceDetail));
 }
Example #6
0
 public InvoiceDetailDTO AddInvoiceDetail(InvoiceDetailDTO invoiceDetail)
 {
     repo.CreateInvoiceDetail(MapDTO.Map <InvoiceDetail, InvoiceDetailDTO>(invoiceDetail));
     return(invoiceDetail);
 }