I want to use this Method in other controllers how can i acheive this.
can i make a different class for this method and then call this method in any controller classes ?
public List<CustomerModel> getDetails()
{
var cust = (from c in db.Customers.Include(c => c.CUSTOMERTYPE)
join ch in db.CUSTOMERHEADs on c.Id equals ch.CustomerId into ps
from ch in ps.DefaultIfEmpty()
select new
{
id = c.Id,
name = c.Name,
company = c.Company,
mb1 = c.Mb1,
address = c.Address,
date_ = c.Date_,
origin = c.Origin,
type = c.CUSTOMERTYPE.Type_,
voucherno = ch.VoucherNo,
});
var details = new List<CustomerModel>();
foreach (var t in cust)
{
details.Add(new CustomerModel()
{
Id = t.id,
Name = t.name,
Company = t.company,
Mb1 = t.mb1,
Address = t.address,
Date_ = t.date_,
Origin = t.origin,
Type_ = t.type,
});
}
return details;
}