public async System.Threading.Tasks.Task<ActionResult> AddProfile() { ProfileCollection coll = new ProfileCollection(); using (var connection = new MySqlConnection(ConfigurationManager.ConnectionStrings[Constants.ConnectionStringName].ConnectionString)) { await connection.OpenAsync(); var result = new ContactRepository(connection).GetContacts(); coll.allContacts = (IEnumerable<Models.Contact>)result.Result.ToArray(); coll.profilecontactselectlist = new SelectList(result.Result.ToList(), "contact_id", "contact_name", new { @required = "required" }); } return View(coll); }
// GET: AddOfficeVisit public async System.Threading.Tasks.Task<ActionResult> EditProfile(int id) { ProfileCollection coll = new ProfileCollection(); using (var connection = new MySqlConnection(ConfigurationManager.ConnectionStrings[Constants.ConnectionStringName].ConnectionString)) { await connection.OpenAsync(); var result = new ProfileRepository(connection).GetProfile(id); var result2 = new ProfileRepository(connection).GetProfiles(); var result3 = new ContactRepository(connection).GetSortedContacts(result.Result.First().contact_id.ToString()); coll.singleProfile = (IEnumerable<Models.ProfileModel>)result.Result.ToArray(); coll.allProfiles = (IEnumerable<Models.ProfileModel>)result2.Result.ToArray(); coll.profilecontactselectlist = new SelectList(result3.Result.ToList(), "contact_id", "contact_name", new { id = "TxtContact", @required = "required" }); } return View(coll); }