|
-
Feb 9th, 2019, 06:58 PM
#1
Thread Starter
Lively Member
How to bind sales header model to collection of sales Footer
problem
How to bind sales header model to collection of sales Footer on SalesOrder controller using ASP.NET core 2.1?
I work on project have Sales Order form this form contain to :
salesHeader model
salesFooter model
so that i already have model Sales Header have navigation property to Sales Footer as following
SalesHeader Model
public int SalesOrderNo { get; set; }
public int SalesYear { get; set; }
public ICollection<SalesFooter> SalesFooters { get; set; }
SalesFooter Model
public int SalesOrderNo { get; set; }
public int Quantity { get; set; }
public int UnitPrice { get; set; }
How to get collection of sales footer on :
on Edit action of sales Order controller how to get collection of sales footer ?
on Edit view(get) sales Order controller how to get collection of sales footer ?
What I have tried:
Repository
public T GetById(int Id)
{
return dbSet.Find(Id);
}
public class SalesOrderController : Controller
{
private readonly IrepositoryTab<SalesHeader> _repositoryHeader;
public SalesOrderController(IrepositoryTab<SalesHeader> SalesHeader, IrepositoryTab<SalesFooter> SalesFooter)
{
this._repositoryHeader = SalesHeader;
this._repositoryFooter = SalesFooter;
}
//get
//Edit Action of sales Order Controller
public IActionResult Edit(int? id)
{
var SalesHeader = _repositoryHeader.GetById(id);
//How to bind with sales footer
return View();
}
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|