I want to remove static keyword from below method and some one help me ,if i remove what are all changes i need to do.
public static SelectList CompaniesByUser(int customerId, User user, bool addBlankOption = false)
{
DbContextScopeFactory DbContext = new DbContextScopeFactory(new Redi2ContextFactory(new LoginSecurityRepo().GetRMApplConnection()));
AmbientDbContextLocator ambientContextLocator = new AmbientDbContextLocator();
var repo = new CompanyRepository(ambientContextLocator);
using (var ctx = DbContext.CreateReadOnly())
{
var companies = repo.GetCompaniesByUser(user, customerId);
if (addBlankOption)
companies.Insert(0, new Organization { Id = 0, Name = "<select company>" });
return new SelectList(companies.Select(c => new { c.Id, Name = string.IsNullOrEmpty(c.OrganizationNumber) ? c.Name : $"{c.Name} | {c.OrganizationNumber}" }), "Id", "Name");
}
}
SelectList companyList = SelectListItemHelper.CompaniesByUser(customerId,user,true);
BillingViewModel model = new BillingViewModel()
{
Companies = SelectListItemHelper.CompaniesByUser(customerId,user,true),
};
return View(model);