/// <summary> /// /// </summary> /// <param name="context"></param> /// <param name="personId"></param> /// <returns></returns> public ApiResponse <bool> DeletePerson(TestProjectDbContext context, Guid personId) { try { Person person = _repository.GetPersonbyId(context, personId); if (person == null) { throw new ErrorException("Person Id is invalid"); } _repository.DeletePerson(context, person); return(ApiResponse <bool> .SuccessResult(true)); } catch (Exception ex) when(ex is FailException || ex is ValidationException || ex is ArgumentException) { return(ApiResponse <bool> .ErrorResult(message : ex.Message, statusCode : HttpStatusCode.BadRequest)); } catch (Exception ex) when(ex is ErrorException) { //LoggingManager.Error(ex.ToString()); return(ApiResponse <bool> .ErrorResult(message : ex.Message)); } catch (Exception ex) { //LoggingManager.Error(ex.ToString()); return(ApiResponse <bool> .ErrorResult(message : ex.Message)); } }