Exemple #1
0
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            await _client.PutContactAsync(Contact.Id, Contact);

            return(RedirectToPage("./Index"));
        }
Exemple #2
0
        public async Task <ActionResult> Edit(int id, IFormCollection collection)
        {
            try
            {
                Contact updateC = new Contact()
                {
                    ContactId = id, FullName = collection["FullName"]
                };
                var c = await cl.PutContactAsync(id, updateC);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }