0 Replies - 468 Views - Last Post: 09 February 2019 - 05:07 PM

#1 ahmedba   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 181
  • Joined: 24-January 14

How to bind sales header model to collection of sales Footer on SalesO

Posted 09 February 2019 - 05:07 PM

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(); 

}
:code:

This post has been edited by modi123_1: 09 February 2019 - 05:10 PM
Reason for edit:: In the future please use the [code] tag button in the editor


Is This A Good Question/Topic? 0
  • +

Page 1 of 1