Пример #1
0
        public IActionResult Delete(string id, IFormCollection collection)
        {
            try
            {
                var user = _userMapper.Find(id); // loads Singer and Choirmaster property too
                _userMapper.Delete(user);
                if (user.Singer != null)
                {
                    _singerMapper.Delete(user.Singer);
                }
                else if (user.Choirmaster != null)
                {
                    _choirmasterMapper.Delete(user.Choirmaster);
                }

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