/// <summary> /// Return a specific contact based on the contact id /// </summary> /// <param name="ContactId">int</param> /// <returns>ContactModel</returns> public ContactModel GetContactById(int ContactId) { RefData refData = RefDataManager.Get(); List <ContactModel> contactsList = refData.ContactList; return(contactsList.Find(item => item.ContactId == ContactId)); }
private void LoadRefData() { var refController = new RefController(); RefData refData = RefDataManager.Get(); refData.ContactList = refController.GetContactList(); RefDataManager.Save(refData); }
/// <summary> /// Display the contact list by 10 /// </summary> /// <param name="page">int</param> /// <returns>contact list</returns> public ActionResult Index(int page = 0) { ViewBag.Message = "Your contact page."; RefData refData = RefDataManager.Get(); IEnumerable <ContactModel> contactsList = refData.ContactList; //Pagination calcuation int PageSize = Convert.ToInt32(ConfigurationManager.AppSettings["Pagination"]); var count = contactsList.Count(); var data = contactsList.Skip(page * PageSize).Take(PageSize).ToList(); this.ViewBag.MaxPage = (count / PageSize) - (count % PageSize == 0 ? 1 : 0); this.ViewBag.Page = page; return(this.View(data)); }