Exemplo n.º 1
0
    public async Task <IActionResult> DeleteDepartmentAsync([FromRoute] Guid id)
    {
        var request = new DeleteDepartmentRequest
        {
            Id = id,
        };
        var response = await _organizationClient.DeleteDepartmentAsync(request);

        return(NoContent());
    }
Exemplo n.º 2
0
        public void DeleteDepartment(Identifier orgUnitId)
        {
            DeleteDepartmentRequest request = new DeleteDepartmentRequest()
            {
                OrgUnitId = orgUnitId
            };

            CallWebService <IOrgUnitManagementServicev1_0, DeleteDepartmentRequest, DeleteOrgUnitResponse>(
                m_service1_0, request, (s, q) => s.DeleteDepartment(q));
            DeleteOrgUnitResponse response = m_service1_0.DeleteDepartment(request);
        }
Exemplo n.º 3
0
 public DeleteDepartmentResponse DeleteDepartment(DeleteDepartmentRequest request)
 {
     try
     {
         var broker = PersistenceContext.GetBroker <IDepartmentBroker>();
         var item   = broker.Load(request.DepartmentRef, EntityLoadFlags.Proxy);
         broker.Delete(item);
         PersistenceContext.SynchState();
         return(new DeleteDepartmentResponse());
     }
     catch (PersistenceException)
     {
         throw new RequestValidationException(string.Format(SR.ExceptionFailedToDelete, TerminologyTranslator.Translate(typeof(Department))));
     }
 }
Exemplo n.º 4
0
 public SuccessResponse Delete(DeleteDepartmentRequest request)
 {
     try
     {
         var department = _departmentRepository.FindBy(request.Id);
         department.ThrowExceptionIfRecordIsNull();
         var isReference = _departmentRepository.IsReference(request.Id);
         isReference.ThrowExceptionIfIsReference();
         _departmentRepository.Remove(department);
         return(new SuccessResponse {
             IsSuccess = true
         });
     }
     catch (DataAccessException)
     {
         throw new ApplicationException();
     }
 }
Exemplo n.º 5
0
    public override async Task <Empty> DeleteDepartment(DeleteDepartmentRequest request, ServerCallContext context)
    {
        await _organizationApp.DeleteDepartmentAsync(request.Id);

        return(new Empty());
    }
 public SuccessResponse Delete(DeleteDepartmentRequest request)
 {
     return(_departmentService.Delete(request));
 }
		public async Task<IActionResult> DeleteDepartment(DeleteDepartmentRequest request)
		{
			var response = await _deleteDepartmentRequestClient.GetResponse<DeleteDepartmentResponse>(request);

			return Ok(response.Message);
		}