public GetContactsOutputDto GetContacts(GetContactsInputDto input) { //Called specific GetAllWithPeople method of task repository. var contacts = _contactRepository.GetAllWithAccount(input.AccountId); //Used AutoMapper to automatically convert List<Task> to List<TaskDto>. return new GetContactsOutputDto { Contacts = Mapper.Map<List<ContactDto>>(contacts) }; }
// GET: Contact public ActionResult Index() { GetContactsInputDto getContactsInput = new GetContactsInputDto(); //if (AbpSession.UserId.HasValue) { getAccountsInput.AssignedUserId = (int)AbpSession.UserId; } return View(_svcContact.GetContacts(getContactsInput)); }
// Lookup Job public ActionResult GetContactListForAutocomplete(string term, long? accountid) { GetContactsInputDto getcontactsinput = new GetContactsInputDto(); var contactList = _svcContact.GetContacts(getcontactsinput).Contacts. Where(c => c.AccountId.Equals(accountid)) .Where(c => c.LastName.ToUpper().Contains(term.ToUpper())) .Take(5) .Select(c => new { id = c.Id, label = c.LastName + "," + c.FirstName }); return Json(contactList, JsonRequestBehavior.AllowGet); }