public DeleteCareTeamDataResponse DeleteCareTeam(DeleteCareTeamDataRequest request) { var response = new DeleteCareTeamDataResponse(); if (request == null) { throw new ArgumentNullException("request"); } if (string.IsNullOrEmpty(request.ContactId)) { throw new ArgumentNullException("Null or Empty ContactId", "request"); } if (string.IsNullOrEmpty(request.Id)) { throw new ArgumentNullException("Null or empty Care Team Id", "request"); } var repo = _factory.GetCareTeamRepository(request, RepositoryType.CareTeam); if (repo == null) { throw new Exception("Repository is null"); } try { if (!repo.CareTeamExist(request.Id)) { throw new Exception(string.Format("Care Team {0} does not exist", request.Id)); } repo.Delete(request); } catch (Exception) { throw; } return(response); }
public DeleteCareTeamDataResponse Delete(DeleteCareTeamDataRequest request) { var response = new DeleteCareTeamDataResponse(); try { if (string.IsNullOrEmpty(request.UserId)) { throw new UnauthorizedAccessException("ContactDD:CareTeamService:Delete Care Team::Unauthorized Access"); } Manager.DeleteCareTeam(request); } catch (Exception ex) { CommonFormat.FormatExceptionResponse(response, base.Response, ex); var aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0"; Helpers.LogException(int.Parse(aseProcessID), ex); } return(response); }
public DeleteCareTeamDataResponse DeleteCareTeam(DeleteCareTeamRequest request) { DeleteCareTeamDataResponse response = null; try { IRestClient client = new JsonServiceClient(); // '/{Context}/{Version}/{ContractNumber}/Contacts/{ContactId}/CareTeams var url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Contacts/{4}/CareTeams/{5}", DDContactServiceUrl, "NG", request.Version, request.ContractNumber, request.ContactId, request.Id), request.UserId); response = client.Delete <DeleteCareTeamDataResponse>(url); } catch (WebServiceException wse) { throw new WebServiceException("AD:DeleteCareTeam()::" + wse.Message, wse.InnerException); } return(response); }