コード例 #1
0
 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));
 }
コード例 #2
0
        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));
            }
        }
コード例 #3
0
        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));
            }
        }