[HttpPost]
public ActionResult Create(Inv_Invoice_Master inv)
{
if (ModelState.IsValid)
{
repository.Insert(inv);
repository.Save();
}
ViewBag.CompanyId = new SelectList(entity.Company_InfoTbl, "CompanyId", "CompanyName", inv.CompanyId);
ViewBag.Sale_Id = new SelectList(entity.Inv_Sells_Details, "Sale_Id", "Sells_Details",inv.Sale_Id);
ViewBag.Payment_Id = new SelectList(entity.Inv_Payment_Master, "Payment_Id", "Payment_Type",inv.Payment_Id);
ViewBag.Cust_ID = new SelectList(entity.Inv_Company_Customer, "Cust_ID", "Cust_Company_Name",inv.Cust_ID);
ViewBag.CurrencyId = new SelectList(entity.Currency_Master, "CurrencyId", "Formal_Name", inv.CurrencyId);
ViewBag.Tax_ID = new SelectList(entity.Inv_Tax_Master, "Tax_ID", "Business_Tax_Name",inv.Tax_ID);
return RedirectToAction("Index");
}
[HttpGet]
public ActionResult Edit(int? id)
{
if (id == null)
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
Inv_Invoice_Master vo = repository.SelectById(id);
ViewBag.CompanyId = new SelectList(entity.Company_InfoTbl, "CompanyId", "CompanyName", vo.CompanyId);
ViewBag.Sale_Id = new SelectList(entity.Inv_Sells_Details, "Sale_Id", "Sells_Details", vo.Sale_Id);
ViewBag.Payment_Id = new SelectList(entity.Inv_Payment_Master, "Payment_Id", "Payment_Type",vo.Payment_Id);
ViewBag.Cust_ID = new SelectList(entity.Inv_Company_Customer, "Cust_ID", "Cust_Company_Name",vo.Cust_ID);
ViewBag.CurrencyId = new SelectList(entity.Currency_Master, "CurrencyId", "Formal_Name", vo.CurrencyId);
ViewBag.Tax_ID = new SelectList(entity.Inv_Tax_Master, "Tax_ID", "Business_Tax_Name",vo.Tax_ID);
return View(vo);
}
I am using this scenario for drop down list but i want to fetch some such as owner name,adress and so on information by using companyId and save it to another as well can be shown on view in the grid view with dynamic fields.