public async Task <ActionResult> Details(string id) { ExchangeClientDemo.Models.MyContact contact = null; try { MyContactsRepository repo = new MyContactsRepository(); contact = await repo.GetContact(id); } catch (RedirectRequiredException x) { return(Redirect(x.RedirectUri.ToString())); } return(View(contact)); }
public async Task <ActionResult> Create(ExchangeClientDemo.Models.MyContact contact) { if (Request.HttpMethod == "POST") { MyContactsRepository repo = new MyContactsRepository(); await repo.AddContact(contact); return(Redirect("/Contacts")); } else { return(View(contact)); } }
public async Task <ActionResult> Edit(string Id, ExchangeClientDemo.Models.MyContact contact) { MyContactsRepository repo = new MyContactsRepository(); if (Request.HttpMethod == "POST") { await repo.UpdateContact(contact); return(Redirect("/Contacts")); } else { contact = await repo.GetContact(Id); return(View(contact)); } }