public void Patch(string id, [FromBody] MergePatchMovementTypeDto value) { try { MovementTypesControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _movementTypeApplicationService.When(value as IMergePatchMovementType); } catch (Exception ex) { var response = MovementTypesControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public void Delete(string id, string commandId, string version, string requesterId = default(string)) { try { var value = new DeleteMovementTypeDto(); value.CommandId = commandId; value.RequesterId = requesterId; value.Version = (long)Convert.ChangeType(version, typeof(long)); MovementTypesControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _movementTypeApplicationService.When(value as IDeleteMovementType); } catch (Exception ex) { var response = MovementTypesControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public void Put(string id, [FromBody] CreateOrMergePatchOrDeleteMovementTypeDto value) { try { // /////////////////////////////// if (value.Version != default(long)) { value.CommandType = CommandType.MergePatch; MovementTypesControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _movementTypeApplicationService.When(value as IMergePatchMovementType); return; } // /////////////////////////////// MovementTypesControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _movementTypeApplicationService.When(value as ICreateMovementType); } catch (Exception ex) { var response = MovementTypesControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }