Esempio n. 1
0
        public ActionResult Create(InvoiceBm invoice, string[] ItemsSelectList)
        {
            if (this.ModelState.IsValid)
            {
                this.invoiceService.CreateInvoice(invoice, ItemsSelectList);
                return(RedirectToAction("Index"));
            }

            return(View());
        }
Esempio n. 2
0
        public void CreateInvoice(InvoiceBm invoiceBm, string[] items)
        {
            Invoice entityInvoice = Mapper.Map <InvoiceBm, Invoice>(invoiceBm);

            foreach (var item in items)
            {
                Item entityItem = this.Context.Items.Find(int.Parse(item));
                entityInvoice.AddItem(entityItem);
            }
            this.Context.Invoices.Add(entityInvoice);
            this.Context.SaveChanges();
        }