public PartialViewResult _PhoneRender(int? id) { var viewModel = new CostumerIndexData(); if (id != null) { viewModel.Phones = db.Phones.Where(x => x.IdCostumer == id.Value); } return PartialView(viewModel); }
public ActionResult Index(int? id) { var viewModel = new CostumerIndexData(); if (id != null) { ViewBag.CostumerId = id.Value; viewModel.Costumers = db.Costumers.Where(x => x.Id == id.Value); viewModel.Phones = db.Phones.Where(x => x.IdCostumer == id.Value); viewModel.Adress = db.Address.Where(y => y.IdCostumer == id.Value); } else viewModel.Costumers = db.Costumers; return View(viewModel); }