Пример #1
0
        public async Task <IActionResult> Edit(int id, IFormCollection collection)
        {
            try
            {
                Contact entry = new Contact()
                {
                    BirthDate  = DateTimeOffset.Parse(collection["BirthDate"]),
                    Company    = collection["Company"],
                    FirstName  = collection["FirstName"],
                    Position   = collection["Position"],
                    SecondName = collection["SecondName"],
                    ThirdName  = collection["ThirdName"]
                };
                var item = await dataService.UpdateItem(entry);

                return(RedirectToAction(nameof(Details), new { id = item.Id }));
            }
            catch
            {
                return(View());
            }
        }