Beispiel #1
0
        public async Task <IActionResult> Create(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.AddItem(entry);

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