示例#1
0
        public async Task <IActionResult> Edit(int id, Contact contact)
        {
            if (id != contact.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                contact.UserId = _userManager.GetUserAsync(HttpContext.User).Result.Id;
                await _contactDAO.Update(contact);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(contact));
        }
 private async void Button_Clicked(object sender, EventArgs e)
 {
     if (Updated)
     {
         manager.Update(contact);
     }
     else
     {
         if (
             String.IsNullOrWhiteSpace(
                 contact.Name) &&
             String.IsNullOrWhiteSpace(
                 contact.LastName))
         {
             await  DisplayAlert("Informacion", "Debe de Digitar la informacion del Contacto", "OK");
         }
         else
         {
             manager.Add(contact);
             await Navigation.PopAsync();
         }
     }
 }