//
 // GET: /CompanyInvoiceItem/Create/5
 //
 public ActionResult Create(int id)
 {
     CompanyInvoice invoice = _repository.GetCompanyInvoiceById(id);
     if (invoice == null)
     {
         return View("CompanyInvoiceNotFound");
     }
     var cii = new CompanyInvoiceItem { CompanyInvoice = invoice };
     return View("Create", cii);
 }
 public ActionResult Create(FormCollection collection)
 {
     var cii = new CompanyInvoiceItem();
     // This will try to update all the fields in the model based on the form collection
     if (TryUpdateModel(cii,
                        new[] { "name", "description", "cost", "invoice_id" },
                        collection))
     {
         if (cii.description == null)
         {
             cii.description = "";
         }
         _repository.AddCompanyInvoiceItem(cii);
         CompanyInvoice invoice = _repository.GetCompanyInvoiceById(cii.invoice_id);
         invoice.created = DateTime.Now;
         _repository.Save();
         return RedirectToAction("Edit", "CompanyInvoice", new { id = cii.invoice_id });
     }
     return View("Create", cii);
 }
Ejemplo n.º 3
0
 public void DeleteCompanyInvoiceItem(CompanyInvoiceItem cii)
 {
     _companyInvoiceItems.Remove(cii);
 }
Ejemplo n.º 4
0
 public void AddCompanyInvoiceItem(CompanyInvoiceItem cii)
 {
     cii.id = ++_companyInvoiceItemsMaxId;
     _companyInvoiceItems.Add(cii);
 }
 public void AddCompanyInvoiceItem(CompanyInvoiceItem cii)
 {
     _conferenceware.CompanyInvoiceItems.InsertOnSubmit(cii);
 }
 public void DeleteCompanyInvoiceItem(CompanyInvoiceItem cii)
 {
     _conferenceware.CompanyInvoiceItems.DeleteOnSubmit(cii);
 }
 partial void DeleteCompanyInvoiceItem(CompanyInvoiceItem instance);
 partial void UpdateCompanyInvoiceItem(CompanyInvoiceItem instance);
 partial void InsertCompanyInvoiceItem(CompanyInvoiceItem instance);
		private void detach_CompanyInvoiceItems(CompanyInvoiceItem entity)
		{
			this.SendPropertyChanging();
			entity.CompanyInvoice = null;
		}