public ActionResult Index() { var model = new ContactsIndexViewModel(); // model.Contacts = _contactsRepository.GetAll(); List <Contact> viziercontacts = new List <Contact>(); IEnumerable <Contact> contacts = _contactsRepository.GetAll(); foreach (Contact i in contacts) { if (i.Type != ContactType.VizierUMTOP && i.Type != ContactType.VizierUKS && i.Type != ContactType.VizierPROJECT) { viziercontacts.Add(i); } } model.Contacts = viziercontacts; return(View(model)); }
public ActionResult ModalSelect() { var model = new ContactsIndexViewModel(); model.Contacts = _contactsRepository.GetAll(); return(PartialView(model)); }
// GET: Contacts public async Task <IActionResult> Index(ContactsIndexViewModel model) { model.Pager ??= new PagerViewModel(); model.Pager.CurrentPage = model.Pager.CurrentPage <= 0 ? 1 : model.Pager.CurrentPage; List <ContactsViewModel> items = await _context.Contacts.Skip((model.Pager.CurrentPage - 1) *PageSize).Take(PageSize).Select(c => new ContactsViewModel() { Id = c.Id, Email = c.Email, Name = c.Note, Note = c.Note, PhoneNumber = c.PhoneNumber }).ToListAsync(); model.Items = items; model.Pager.PagesCount = (int)Math.Ceiling(await _context.Contacts.CountAsync() / (double)PageSize); return(View(model)); }