public IActionResult DeleteByPost(
            Guid personGuid)
        {
            var person =
                _personData
                .GetPerson(personGuid);

            if (person == null)
            {
                return(NotFound());
            }

            _personData.DeletePerson(person);

            //
            // Delete RDF
            //

            _rdfData.DeletePerson(person.PersonGuid);

            //
            // Update search index
            //

            // TODO try catch to handle errors
            _personSearchIndex.DeletePerson(person.PersonGuid);

            //
            // Redirect
            //

            return(RedirectToAction(
                       "PersonList",
                       "Home"));
        }
Example #2
0
        public IActionResult DeletePerson(Guid id)
        {
            var person = _personData.GetPerson(id);

            if (person != null)
            {
                _personData.DeletePerson(person);
                return(Ok());
            }
            else
            {
                return(NotFound($"Person with ID {id} could not be found"));
            }
        }
        // Delete employee with database Id = id
        public async Task <IActionResult> DeletePerson(int id)
        {
            await _data.DeletePerson(id);

            return(RedirectToAction("ViewPersons"));
        }