Example #1
0
        public IActionResult DeleteConfirmed(int id)
        {
            var person = _peopleService.GetPersonById(id);

            _peopleService.DeletePerson(person);
            return(RedirectToAction(nameof(Index)));
        }
Example #2
0
        public void Delete(int personID)
        {
            Person personToDelete = _peopleService.GetPersonByID(personID);

            if (personToDelete == null)
            {
                NotFound();
            }

            _peopleService.DeletePerson(personToDelete);
        }
Example #3
0
 public IActionResult DeleteConfirmed(int id)
 {
     try
     {
         _peopleService.DeletePerson(id);
     }
     catch (Exception)
     {
         throw;
     }
     return(RedirectToAction(nameof(Index)));
 }
 public ActionResult Delete(PersonN model)
 {
     try
     {
         _peopleService.DeletePerson(model);
         return(RedirectToAction("Index"));
     }
     catch (Exception)
     {
         return(View("NotFound"));
     }
 }
        public IActionResult DeletePerson(int id)
        {
            var personBl = _people.GetPerson(id);

            if (personBl == null)
            {
                return(BadRequest());
            }

            _people.DeletePerson(personBl);

            return(Ok());
        }
        public ActionResult DeletePerson(int id)
        {
            try
            {
                _peopleService.DeletePerson(id);
                return(Ok());
            }
            catch (ItemNotFoundException ex)
            {
                _logger.LogError("failed to delete person", ex);

                return(NotFound());
            }
        }
        public void DeletePerson_Should_Delete_Person_From_Database()
        {
            Person person = new Person {
                Name = "personName"
            };

            _personRepository.Add(person);

            _peopleService.DeletePerson(person);

            IEnumerable <Person> personsOnDb = _personRepository.RetrieveAll();

            personsOnDb.Should().BeEmpty();
        }
Example #8
0
 public ActionResult <PersonDto> Delete(int id)
 {
     return(_peopleService.DeletePerson(id));
 }
 public async Task Handle(DeletePersonCommand message, IMessageHandlerContext context)
 {
     await _peopleService.DeletePerson(message.Id, message.UserId);
 }
Example #10
0
        public async Task <IActionResult> DeletePerson(long id)
        {
            await _peopleService.DeletePerson(id);

            return(NoContent());
        }